class Test {
public function hello() {
}
public function helloa() {
}
public function hellob() {
}
}
function microtimeFloat() {
list($usec, $sec) = explode(" ", microtime());
return ((float) $usec + (float) $sec);
}
$test = new Test();
for ($index1 = 0; $index1 < 10; $index1++) {
$begin1 = microtimeFloat();
for ($index = 0; $index < 1000; $index++) {
$class = new ReflectionClass($test);
$methods = $class->getMethods();
foreach ($methods as $method) {
$method->invoke($test);
}
}
echo microtimeFloat() - $begin1 . ‘----‘;
$begin2 = microtimeFloat();
for ($index = 0; $index < 1000; $index++) {
$methods = get_class_methods($test);
foreach ($methods as $method) {
$test->$method();
}
}
echo microtimeFloat() - $begin2;
echo ‘<br/>‘;
}get_class_methods vs Reflection,布布扣,bubuko.com
get_class_methods vs Reflection
原文:http://blog.csdn.net/starparker/article/details/21974837