go to bug id or search bugs for
Currently there is no way to access global variables inside a function/class scope without using the global keyword or $GLOBAL variable
As a result it is not possible to create for example a Config class that can easily be accessed throughout an entire project
To have usable code one is forced to use static classes, retrofit some sort of static constructor/init function and reference the config variables with for example Config::$defaultUser
If it where possible to register custom superglobal one could use an instance of these kind of classes instead of a static class.
For php7 it is said that an Array Constant can be created which will create a partial solution.
Having the possibility to register a variable as a superglobal would greatly reduce the need for static classes and/or other trickery.
An alternative would be to have the possibility of adding custom superglobals in php.ini but this would be less practical
// Suggested ways to use it on the php coding side
$config = Config::getInstance(); //singleTon
Add a Patch
Add a Pull Request
Found a Wontfix, see