The $GLOBAL autoglobal contains all variables available in the current scope. Global variables can be added directly to the array, or the keyword global can be used, as in the example.
<?php
$a = 5;
$b = 5;
function change()
{
$a += 5;
}
function change_global()
{
global $b;
$b += 5;
}
change();
change_global();
print "a: $a <br>";
print "b: $b <br>";
?> a: 5
b: 10 The function change() cannot access the variable a, since it is not in the global scope.