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