<?php
function test()
{
static $a = 0, $b = 15;
$a++;
$b++;
return $a;
}
$rf = new ReflectionFunction('test');
// 結果 - 陣列 ( [a] => 0 [b] => 15 )
print_r( $rf->getStaticVariables() );
//呼叫 test 函式並再次印出靜態變數
test();
// 結果 - 陣列 ( [a] => 1 [b] => 16 )
print_r( $rf->getStaticVariables() );
?>