Here's what I was doing in the past
//file: bar.php
defined('MYC') or define('MYC', 'val1');
//file: bootstrap.php
define('MYC', 'val2');
I would include bootstrap.php first which would set MYC = 'val2'.
Now bar.php is in the \Foo\Bar namespace, i.e. to say
//file: bar.php
namespace Foo\Bar;
defined('MYC') or define('MYC', 'val1');
//file: bootstrap.php
//following doesn't work
//const \Foo\Bar\MYC = 'val2';
//?? what do I do here ??
const MYC = 'val1';innamespace Foo\Bar;so I guess I will have to live with shitty_long_namespaced_global_constant_names :(define (__NAMESPACE__ . '\CONST_IN_NAME_SPACE')to get it to create a constant in the current namespace. Alternatively, you can useconstif you don't have to calculate the value of the constant before defining it.