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