it's a predefined variables in PHP which are always accessible of scope and you can access them
from any function and class. The PHP superglobal variables are:
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
PHP Global Variables - Superglobals :
it's a predefined variables in PHP which are always accessible of scope and you can access them from any function and class. The PHP superglobal variables are:
PHP $GLOBALS:
$GLOBALS[index] in PHP it means which is stores all global variables in array. The index holds the name of the variable.
<?php $x =10; $y =20; function addition() { $GLOBALS['z'] = $GLOBALS['x'] + $GLOBALS['y']; } addition(); echo $z; ?>PHP $_SERVER :
it is holds information about headers, paths and script locations in PHP super global variable.