Static in PHP:
Retains the local variable value and it donot loose its value at the end of function call.
<?php
function f()
{
static $x=1;
echo $x.”<br />”;
$x++;
}
f();
f();
?>
Output of this program:
1
2
Learn Graphic Design Animation & Stock Market Course – Online Computer Teacher
Photoshop illustrator CorelDraw Animate CC & Share Trading Courses Ph. (+91 India) 9163111390
Static in PHP:
Retains the local variable value and it donot loose its value at the end of function call.
<?php
function f()
{
static $x=1;
echo $x.”<br />”;
$x++;
}
f();
f();
?>
Output of this program:
1
2