- microtime: documentation ( source)
<?php
class Foo {}
$foo = new Foo;
$rounds = 1000000;
$start = microtime(true);
for($i=0; $i<$rounds; $i++) {
get_class($foo);
}
echo (microtime(true) - $start);
echo "\n";
$name = (new ReflectionClass($foo))->getName();
$start = microtime(true);
for($i=0; $i<$rounds; $i++) {
$name;
}
echo (microtime(true) - $start);