PHP4 to PHP5 Environmental Variable Usage

The use of unscoped environmental variables, such as $REMOTE_ADDR, were depracated from PHP4 to PHP5 and no longer supported without first providing a scope. This was implemented to prevent confusion between cross-referencing a variable that was passed in a form as well as a cookie (but without scoping, PHP wasn’t sure which variable you wanted to reference).

In PHP5, the environmental scopes work like arrays. Available environmental scopes include:

$_POST[“variablename”] (passed from a form)

$_GET[“variablename”] (passed from a URL)

$_COOKIE[“variablename”] (passed from a cookie)

$_SERVER[“variablename”] (passed from a environmental variables such as browser headers)

Example: the use of $REMOTE_ADDR in PHP4.

In PHP5, the variable would be referenced as $_SERVER[“REMOTE_ADDR”].