PHP $Globals with Examples

PHP $Globals with Examples


PHP $GLOBALS is the only superglobal that does not begin with an underscore (_). It is an array that stores all the global scope variables.$ GLOBALS is a composition that contains an array of all global variables.$GLOBALS in PHP is used to access all global variables (variables from global scope) i.e. the variable that can be accessed from any scope in a PHP script.

Example :

Output : 30