PHP » Predefined Variables

PHP uses predefined variables to provide access to important information about the server and requests from a browser. This section describes the predefined variables available.

Since version 4.1.0 of PHP, the use of the new autoglobals, also known as superglobals, have been the recommended way to access predefined variables.

Before the introduction of the autoglobals, these variables were accessible through similar arrays (often referred to as the $HTTP_*_VARS). These variables were not global, which made coding more cumbersome. Instead, people often relied on the register_globals configuration directive, which would make the all the individual elements in the $HTTP_*_VARS available as global elements. The drawback of this approach is severe cluttering of the global scope.

The old methods of $HTTP_*_VARS are still available, but this section, as well as the rest of this quick reference, will assume that the recommended autoglobals are used. The autoglobals are associative arrays with the variable names as keys. This section lists the autoglobals available.