test1.php
<?php
$a = 5;
function test() {
static $a = 0;
return ++$a;
}
echo test();
echo test();
echo test();
exit;
Results: 123
test2.php
<?php
$a = 5;
function test() {
static $a = 0;
return ++$a;
}
echo test();
echo test();
echo test();
exit;
Results: 111
Reproduced in: https: //www.jianshu.com/p/2446642e4811