O'Reilly logo

Core PHP Programming: Using PHP to Build Dynamic Web Sites by Leon Atkinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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. These are turned into PHP variables for your convenience. Listing 7.2 tells you which browser someone is using to surf your page.

Similar to environment variables are the variables the 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 HTTP_GET_VARS, HTTP_POST_VARS, and HTTP_COOKIE_VARS. As ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required