PHP has provided predefined variables which are called super globarl variables. In a PHP website project, there might be situation to store logged in user information, access web url info and server related data. In such cases, super global variables are useful.
PHP Super Global Variables
There are nine types of Super Global Variables exist in PHP. And they are as below.
$GLOBALS is a super global variable. It is type of Array variable. And it holds all the global variable name.
Headers, path and script location related information is stored in the $_SERVER variable. It is also a super global variable.
Date sent from one script to another can be obtained using $_REQUEST super global variable. ($_POST,$_GET is widely used over $_REQUEST)
Data sent from one script to another using POST method can be obtained using $_POST super global variable.
Data seeking to receive from one script to another using GET method can be obtained using $_GET super global variable.
If a data we want to store temporary such as user’s valid login then $_SESSION super global variable is useful. We can store data in this variable. And this data is available until unless the session is active.
It is a super global variable and holds cookie data.