Storing data in $GLOBALS


i need to have some Global Vars.
Is there a problem, if i would store them in $GLOBALS ?


You don’t actually store anything in $GLOBALS, because it’s actually only storing references to variables in the global scope.

If you have problems remembering which variables are global and which are local inside of long function definitions, you might want to use $GLOBALS to help you remember. Otherwise, you might as well just use the “global” keyword at the beginning of the function definition so you don’t have to keep plugging in $GLOBALS every time you want to use the variables.

function gkeyword()
    global $var;