- microtime: documentation ( source)
- round: documentation ( source)
- pow: documentation ( source)
<?php
function foo() {
$foo = array();
for($x = 0; $x < 100000; $x++){
$foo[] = pow($x,$x);
}
return $foo;
}
$t = microtime(true);
foreach(foo() as $val){
$val = $val + 2;
}
echo round(microtime(true) - $t, 5)."\n";
$t = microtime(true);
$foo = foo();
foreach($foo as $val){
$val = $val + 2;
}
echo round(microtime(true) - $t, 5)."\n";