RSS

Super Global Variables

Thu, Jul 17, 2008

PHP

Super Global Variables in PHP, known as the Superglobals, are predefined variables witch have a scope of global. Thus, you can use any of them you want in anywhere in your PHP code.

There is a list of Superglobals:

  1. $_SERVER['Key']:$_SERVER is a array, so it contain keys to hold several value regarding some information such as path, location, header. Following keys are using with $_SERVER.
    • DOCUMENT_ROOT:hold the information of the path of current file. If you creat a file located in the C:/xampp/htdocs path, and input <?ph echo $_SERVER['DOCUMENT_root']; ?>, save this file by .php extension. Then you try to run this file, there will be a output as C:/xampp/htdocs in your browser.

PS:Both of Superglobals and the keys of them must be written by uppercase. Because in PHP, Variables are case sensitive.

Related Posts

Tags: , ,
Trackback URL:

This post was written by:

cXY - who has written 23 posts on cXY Lab.


Contact the author

Leave a Reply