- microtime: documentation ( source)
<?php
$start = microtime(true);
switch (pcntl_fork()) {
case -1:
die('problem');
break;
case 0:
$a = 234325;
for ($i = 0; $i < 1000000; ++$i) {
// wasting CPU
$a *= $i;
}
break;
default:
pcntl_wait();
echo "the child took " . (microtime(true) - $start) . " micro seconds";
}