Superglobal variables in PHP

PHP has a list of built-in variables, which are known as superglobal variables. It provide information about the PHP script’s environment.

The variables are always available in all parts of the script. The following table shows the list of  PHP superglobal variables:

Superglobal VariablesMeaning
$GLOBALSReturns an array that contains global variables. The variable names are used to select which part of the array to access.
$_SERVERReturns data about the webserver environment.
$_GETReturn data from GET requests.
$_POSTReturn data from POST requests.
$_COOKIEReturn data from HTTP cookies
$_FILESReturn data from POST file uploads.
$_ENVReturn information about the script’s environment.
$_REQUESTReturn data from the HTTP request
$_SESSIONReturn variables registered in a session