php计算程序执行时间

$s = microtime(true);
for ($i = 1; $i < 10000; $i += 1) {
// function()
}
$e = microtime(true);
echo $e - $s;