- microtime: documentation ( source)
<?php
$test = array();
$i = 0;
$start = microtime(true);
for($i = 0; $i < 100000; $i++) {
if(count($test)) {
throw new Exception();
}
}
$middle = microtime(true);
for($i = 0; $i < 100000; $i++) {
if (!empty($test)) {
throw new Exception();
}
}
$end = microtime(true);
echo ($middle - $start) . chr(10);
echo ($end - $middle) . chr(10);
?>