microtime如何在php中运行

时间:2010-07-27 12:13:54

标签: php

PHP mico时间,我想使用microtime来处理我的应用程序

1 个答案:

答案 0 :(得分:3)

我认为来自PHP.net的PHP5脚本示例非常简单。

<?php
// Put this at the start of your script
$time_start = microtime(true);

// This is where your script should be executing,
// but instead, we sleep for a while
usleep(100);

// Calculation at the end of the script
$time_end = microtime(true);
$time = $time_end - $time_start;

// Do something with the results
echo "Did nothing in $time seconds\n";
?>