Generally Variables in PHP are defined by ” $” symbol followed by
name of the Variable. Variables in PHP are case sensitive.
$age = 25; // local scope
echo "The Variable age defined inside the function and the value is: ".$age." <br><br>";
myVariables(); // if you call the age variable outside function, will give an error
echo "The Variable age outside function is: ".$age."";
The Variable age defined inside the function and the value is: 25
But, global variables can also be accessed inside the function also, by using the keyword
global before the variable declaration.
static. Static is kept before the variable, at the first time of declaration.