- microtime: documentation ( source)
- round: documentation ( source)
<?php
class foo {
public function bar($x,$y){
return $x*$y;
}
}
$s = microtime(true);
$foo = new foo();
for($x = 0; $x < 10000; $x++ ){
call_user_func(array($foo, 'bar'), 10,20);
}
echo round(microtime(true) - $s,5)."\n";
$s = microtime(true);
$foo = new foo();
$bar = 'bar';
for($x = 0; $x < 10000; $x++ ){
$foo->$bar(10,20);
}
echo round(microtime(true) - $s,5)."\n";