Global: all references to variable will refer to the global version. There is no limit to the number of global variables that can be modified by a function.
Example:
<?php
$x = 1;
$y = 2;
function Sum()
{
global $x, $y;
$y = $x + $y;
}
Sum();
echo $y;
?>
$GLOBALS: References to all variables available in global scope. An associative array contains references to all variables which are currently described in the global scope of the script. The variable names are the keys of the array.
Example:
<?php
function test() {
$foo = "local variables";
echo '$foo in global scope: ' . $GLOBALS["foo"] . "\n";
echo '$foo in current scope: ' . $foo . "\n";
}
$foo = "Example Info";
test();
?>