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 Photoshop C++ Java Python Courses Online Kolkata
Online Computer Teacher | Free Trading Tips | Ph. (+91) 8240519356
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