- microtime: documentation ( source)
<?php
const START=0;
const NUM=1000;
const NEST=1000;
for($i = START; $i < NUM; $i += 1) {
$a[$i] = TRUE;
}
$start = microtime(TRUE);
for($n = 0; $n < NEST; $n++) {
for($i = START; $i < NUM; $i += 1) {
$a[$i];
}
}
echo 'Time: '.(microtime(TRUE) - $start).PHP_EOL;
$start = microtime(TRUE);
for($n = 0; $n < NEST; $n++) {
for($i = START; $i < NUM; $i += 1) {
//$a[$i];
}
}
echo 'Time: '.(microtime(TRUE) - $start).PHP_EOL;