static(静的)変数2(再帰関数の例)



1
2
3
4
5
6
7
8
9
10

source

<?php
//静的関数の処理に注目
Function test() {
	static $count = 0;
	$count++;
	echo $count,"<br>";
    if ($count < 10) {
		test();
	}
    $count--;
}
test()
?>