PHP get_class_vars 和 (array)
<?php class Girl { public $id = 1; public $name = 'zhy'; } $start = microtime(TRUE); var_dump(get_class_vars(get_class(new Girl()))); $end = microtime(TRUE); echo "\n" . ($end - $start) . "\n"; $start = microtime(TRUE); var_dump((array)(new Girl())); $end = microtime(TRUE); echo "\n" . ($end - $start) . "\n";
一次测试,只看一次的测试:
学习记录,方便复习