7.4. Environment Variables
PHP also makes environment variables available. These are the variables that are created when you start a new shell. Some are the standard variables like PATH. Others are variables defined by the CGI. Examples are REMOTE_ADDR and HTTP_USER_AGENT. PHP adds them all to the _SERVER array for your convenience.
Similar to environment variables are the variables that PHP itself creates for you. The first is GLOBALS, which is an associative array of every variable available to the script. Exploring this array will reveal all the environment variables as well as a few other variables. Similar to GLOBALS are _GET, _POST, _COOKIE, _SERVER, and _REQUEST. As their names suggest, they are associative arrays of the variables created ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access