and does it make sense that if I use $ GLOBALS ["test"] instead of $ _SESSION ['test']?
No, session is different from a variable available worldwide.
$ GLOBALS
An associative array containing references to all the variables that are currently defined globally from the script. Variable names are the keys of the array.
http://php.net/manual/en/reserved.variables.globals.php
Explanation:
$GLOBALS - associative array available throughout your script, no need to use global $test
Note: this is a "superglobal", or automatic global, variable. This simply means that it is available in all areas within the script. There is no need to make a global variable $; to access them as part of functions or methods.
source share