The global function changes the scope of a variable.
For example:
function xx()
{
global $var1
$var1 = \"Variable 1\";
$var2 = \"Variable 2\";
}
echo $var1;
echo $var2;
Output:
Variable 1
In the example above, $var2\'s scope is local to the function itself, whereas $var1\'s scope is global, and so $var1 can be seen outside of the function.