What is $GLOBALS?
$GLOBALS is a super global variable that may be accessed from anywhere in the PHP script. All global variables are stored in the array $GLOBALS[], where index is the global variable name that may be retrieved.
All global variables are stored in an array named $GLOBALS[index] in PHP. The variable’s name is stored in the index.
![Global Variables - Superglobals Several predefined variables in PHP are "superglobals", which means that they are always accessible, regardless of scope. - ppt download](https://images.slideplayer.com/26/8596001/slides/slide_2.jpg)
The example below shows how to use the super global variable $GLOBALS:
Example:-
Output:-
![](https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-191.png)
Two global variables, $x and $y, are declared in the above code and are given a value. Then, in the GLOBAL array, a function multiplication() is written to multiply the values of $x and $y and store the result in another variable $z.