PHP merge two files with constants
<p>I have a PHP script that needs an upgrade and it has about 50 language files that define language strings as constants e.g.:</p>

<pre><code>define('ERROR_LOGIN', 'Wrong username and password');
define('SUCCESS_LOGIN', 'Successful login');
define('COPYRIGHT', '&amp;copy; 2012 Company inc.');
</code></pre>

<p>...etc. Some constants are even multi-line and have escaped characters etc.</p>

<p>We have our own translation of these language files but now we want to upgrade to a new version of this script that features a lot of new constants since it also has numerous new features. These new constants are not defined at the end of new language files - it would be easy just to copy/paste new strings - they are defined even between the old ones and also some of the old ones are obsolete now in new version.</p>

<p>So my question is - what would be the easiest way to merge old and new language files by preserving the constants of old files and only adding the new constants at the end of the file so we can translate only new ones?</p>

<p>thanx!</p>
