代码示例:(标识:demo_php_func_microtime)
<!DOCTYPE html>
<html>
<body>


<?php
echo(microtime());


/**
 * 重复 PHP 5 行为的简单函数
 */
function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

$time_start = microtime_float();

// 休息一会儿
usleep(100);

$time_end = microtime_float();
$time = $time_end - $time_start;

echo "Did nothing in $time seconds\n";

?>


</body>
</html>
运行结果: