Hi! > I don't think this is a safe optimization. In the following case it would > output 'b' and not 'a' which is the correct result: > > a.php: > <?php > define('FOO', 'a'); > include('b.php'); > ?> > > b.php: > <?php > define('FOO', 'b'); > echo FOO; > ?> > > It is certainly not likely for a constant to be defined twice but PHP > currently just issues a notice and continues with the first constant value.
It's more likely than you think, especially given that on the way between define and include there could be other code doing various checks and calculations. In general, any optimization involving global context is very dangerous in PHP since the script can be run in different global contexts. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php