how to set global variable in php code example
Example 1: how make a variable global php
$a = 1;
$b = 2;
function Sum(){
global $a, $b; // allows access to vars outside of function
$b = $a + $b;
}
Sum();
echo $b; // output is 3
Example 2: php globals
$GLOBALS["foo"]