function test()
{
static $a = 0;
echo $a . " ";
$a++;
}
for ($i = 0; $i < 10; $i++)
test();
?>
0 1 2 3 4 5 6 7 8 9
<?php
function test()
{
static $count = 0;
$count++;
echo $count . " ";
if ($count < 10) {
test();
}
$count--;
}
test();
?>
static $a = 1 + 2;
static $b = sqrt(121);
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |