Pages

Saturday, October 24, 2015

PHP - Predefined Variables

PHP provides a large number of predefined variables to any script which it runs. PHP provides an additional set of predefined arrays containing variables from the web server the environment, and user input. These new arrays are called superglobals −
All the following variables are automatically available in every scope.

PHP Superglobals

VariableDescription
$GLOBALSContains a reference to every variable which is currently available within the global scope of the script. The keys of this array are the names of the global variables.
$_SERVERThis is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these. See next section for a complete list of all the SERVER variables.
$_GETAn associative array of variables passed to the current script via the HTTP GET method.
$_POSTAn associative array of variables passed to the current script via the HTTP POST method.

No comments:

Post a Comment