- microtime: documentation ( source)
- range: documentation ( source)
<?php
$a=range(1,10000);
function odd($elt) {
return $elt & 1;
}
$start=microtime(true);
for ($i=0;$i<100;$i++) {
$b = array();
for ($j=0; $j<10000; $j++) { if ($a[$j] & 1) $b[] = $a[$j]; }
}
echo "time = ", microtime(true) - $start, "\n";