Originally posted by philipolson
track_vars is dead, using autoglobals is the preferred method. Don't use $GLOBALS as this means you're relying on register_globals = on, a directive that now defaults to off (as of PHP 4.2.0).
There is talk of killing register_globals, in fact, some people consider it deprecated. For future code compatibilty, use the predefined autoglobal arrays instead.
Another option is import_request_variables().
Killing register_globals would not bother me in the slightest, I am a proponent of declaring variables explicitly anyway for code flow purposes, not even mentioning the security issues.
The $GLOBALS array holds all the predefined variables at this point and does NOT depend on register_globals being on. As a matter of fact, if register_globals is off AND track_vars is off, I believe the $GLOBALS array is the only means of accessing any of the predifined variables. At any rate, it works fine for me at this time and I have register_globals turned OFF and error_reporting set to E_ALL.
track_vars registers the predefined variable arrays much like register_globals registers the variables themselves. Much like register_globals, it seems to have been provided for convenience. I am kind of surprised it is not in php.ini anymore and was wondering why.