Superglobals

March 28th, 2005. Tagged: PHP certification

So far (end of chapter 1, just before jumping into the OO part) the book doesn't say a word about superglobals. I think this is an important topic and I suppose there must be questions about the superglobals on the exam.

The best place to get an idea about the superglobals is this PHP.net manual entry.
Note how there was a different set of superglobals prior to php.4.1 but I was lead to believe that the exam is concentrated on stuff after 4.1. (and before php5).

Briefly, here's the list of superglobals:

  • $_GET - variables sent using a GET HTTP request
  • $_POST - variables sent using a POST HTTP request
  • $_COOKIE - array of all cookies that are sent by the server
  • $_REQUEST - a merge of the three above
  • $_SESSION - array containing the session data
  • $_SERVER - server variables like REMOTE_ADDR, SCRIPT_NAME, REQUEST_URI, etc.
  • $_ENV - more or less the same as $_SERVER
  • $_FILE - data about uploaded files
  • $GLOBALS - array of all global variables, see the previous blog entry for an example

Tell your friends about this post: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile, hit me up on twitter @stoyanstefanov