One of the important feature of variable scoping is the static variable. A static variable available only in a local function scope, but it doesn’t lose its value when program execution leaves this scope. Consider the below example:
Example:
<?php
function test()
{
$x = 0;
echo $x;
$x++;
}
?>