After using php for so long, I'd just noticed that in php:-
$a = 'something';
$GLOBALS['a'] = 'another thing';
is actually the same thing. Checking back the documentation, it's clearly stated that,
Note: $GLOBALS has been available since PHP 3.0.0.
An associative array containing references to all variables which are currently defined in the global scope of the script. The variable names are the keys of the array.
This is a 'superglobal', or automatic global, variable. This simply means that it is available in all scopes throughout a script. You don't need to do a global $GLOBALS; to access it within functions or methods.
damn ... shame on me !! I spent an hour debugging my code when somehow I overwrote my globals variable and things start to break. Maybe I should use some convetions for all my globals in the future. Something like $GLOBALS['_this_is_global'], the underscore will clearly indicated that it is a global. this why we need namespace :(
