How to Use Old Code with New Versions of PHP
Sunday, August 16th, 2009
PHP developers try to maintain backwards compatibility in PHP programming such that a script written for an older version will still run without changes in a newer version. Two of the most important recent changes that affect old code are:
• The deprecation of the old $HTTP_*_VARS arrays which should be indicated as global when used inside a function or method. The following superglobal arrays were introduced in PHP » 4.1.0. They are: a) $_GET; b) $_POST; c) $_COOKIE; d) $_SERVER; e) $_FILES; f) $_ENV; g) $_REQUEST, and; h) $_SESSION. The older $HTTP_*_VARS arrays like $HTTP_POST_VARS are also available. In PHP 5.0.0, the long PHP predefined variable arrays may be disabled with the register_long_arrays directive.
• By default, external variables are no longer registered in the global scope, meaning in PHP » 4.2.0 the PHP directive register_globals is off by default in php.ini. These values can be accessed through the superglobal arrays.