- microtime: documentation ( source)
- number_format: documentation ( source)
<?php
class Test {
public function method()
{
}
}
$obj = new Test;
$ref = new ReflectionMethod($obj, 'method');
$closure = $ref->getClosure($obj);
echo "Starting loop...";
$start = microtime(true);
for ($i=0; $i<1e6; $i++) {
$closure();
}
echo "Took ", number_format((microtime(true)-$start)*1e3, 3), " ms";