Copy the code The code is as follows:
$a = 1;
include 'b.inc';
?>
Copy code The code is as follows:
$a = 1 ; /* global scope */
function Test ()
{
echo $a ; /* reference to local scope variable * /
}
Test ();
?>
< ?php $a = 1; $b = 2;
function Sum (){
global $a, $b;
$b = $a + $b;
}
Sum ();
echo $b ;
?>
The output of the above script will be "3".
The above introduces the global variable PHP global variable scope analysis, including the content of global variables. I hope it will be helpful to friends who are interested in PHP tutorials.