- microtime: documentation ( source)
<?php
function foo() {
bar();
}
function bar() {
baz();
}
function baz() {
boom();
}
function boom() {
return false;
}
function test($n) {
for ($i = 0; $i < $n; $i++) {
foo();
}
}
$n = 1000000;
$t = microtime(true);
test($n);
echo (microtime(true) - $t)*1000000/$n . ' us/iteration';