How to use of Static Variable and Variable in PHP?

6

<?php
function show()
{
static $counter=0;
$counter2=0;
echo “<br>”.”This is static variable : “.$counter;
echo “<br>”.”This is non static variable : “.$counter2;
echo “<br>”;
return $counter=$counter+1;
return $counter2=$counter2+1;
}

show();
show();
show();
?>

Please follow and like us:
0

Add a Comment

Your email address will not be published. Required fields are marked *