PHPのglobalとstatic
$g = 10; function func() { global $g; static $s = 0; print "$g $s\n"; $g++; $s++; } foreach (array(1,2,3) as $false){ func(); } // 10 0 // 11 1 // 12 2
$g = 10; function func() { global $g; static $s = 0; print "$g $s\n"; $g++; $s++; } foreach (array(1,2,3) as $false){ func(); } // 10 0 // 11 1 // 12 2