Superglobals in php
Superglobals are specially-defined array variables in PHP that make it easy for you to get information about a request or its context. The superglobals are available throughout your script. They are mainly used to store and get information from one page to another etc in an application.
$GLOBALS - It is a superglobal variable which is used to access global variables from anywhere in the PHP script.
$_SERVER - It is a PHP super global variable that stores the information about headers, paths and script locations.
$_REQUEST - It is a superglobal variable which is used to collect the data after submitting a HTML form.
$_POST and $_GET - these are super global variables used to collect data from the HTML form after submitting it.
The content is easy to understand.Thank you for explaining it in a simple way.
Superglobals are the variables which are already created by the PHP engine for us. So some of the global variables are $GLOBAL, $_POST, $_GET, $_COOKIE, $_SESSION, $_SERVER, $FILES, $_REQUEST,and $_ENV. Lets check each one of them individually.
$GLOBAL is used to access global variable where ever you need the variable, maybe in function, in loops or PHP script.
The output for the above code is 5.
$_POST and $_GET are used to get information send in the page request. Parameters send in the Url are made available by $_GET .
$_POST is used to send data to the script and used mainly for confidential data like username or password.
$_REQUEST is the amalgam of $_POST and $_GET data. $_SESSION and $_COOKIE are used for creating sessions and cookies respectively. Following is example of session,
$_SESSION["videogame"] = "Battletoads";
Go to page 2
$_SERVER is a superglobal store the information of the web server and the request made to it.