PHP has three different variable scopes: local, global and static
Global: A variable declared outside a function has a GLOBAL SCOPE and can only be accessed outside a function
Local: A variable declared within a function has a LOCAL SCOPE and can only be accessed within that function
Static: The static keyword when you first declare the variable
<?php
$m=5; //Global Variable
function test(){
$x=10; //Local Variable
global $m;
echo $y=$x+$m;
echo "<br/>";
static $n=0;
echo $n;
$n++;
}
?>

