1 2 3 4 5 6 7 8 9 10
<?php function doSomething() { static $i = 0; return $i++; } echo doSomething() . "\n"; // 0 echo doSomething(); // 1 ?>
1 2
0 1