是否有可能获得类定义静态数组的计数?例如:获取类静态数组的数量()
class Model_Example
{
const VALUE_1 = 1;
const VALUE_2 = 2;
const VALUE_3 = 3;
public static $value_array = array(
self::VALUE_1 => 'boing',
self::VALUE_2 => 'boingboing',
self::VALUE_3 => 'boingboingboing',
);
public function countit()
{
// count number
$total = count(self::$value_array);
echo ': ';
die($total);
}
}
目前调用countit()方法返回:
做工精细这里http://codepad.org/XfFhv5FP –