php 计算代码执行时间
2014-09-16 18:09
471 查看
转载链接:http://blog.csdn.net/php_boy/article/details/6450678
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->get_microtime();
}
function stop()
{
$this->StopTime = $this->get_microtime();
}
function spent()
{
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}
}
$run_time = new runtime();
$run_time->start();
//begin your code
//end your code
$run_time->stop();
echo "Script running time:".$run_time->spent()."ms";
class runtime
{
var $StartTime = 0;
var $StopTime = 0;
function get_microtime()
{
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}
function start()
{
$this->StartTime = $this->get_microtime();
}
function stop()
{
$this->StopTime = $this->get_microtime();
}
function spent()
{
return round(($this->StopTime - $this->StartTime) * 1000, 1);
}
}
$run_time = new runtime();
$run_time->start();
//begin your code
//end your code
$run_time->stop();
echo "Script running time:".$run_time->spent()."ms";
相关文章推荐
- 解析PHP计算页面执行时间的实现代码
- php 计算代码执行时间
- php 计算页面执行时间来优化代码
- php计算某段代码执行时间
- php计算代码执行时间
- 解读PHP计算页面执行时间的具体代码实现
- php 页面执行时间计算代码
- 计算php代码执行时间长短的类(精确到毫秒)
- php页面执行计算时间代码
- 解析PHP计算页面执行时间的实现代码
- php使用microtime(true)计算php程序代码执行消耗时间
- php使用microtime(true)计算php程序代码执行消耗时间
- 计算php代码执行时间长短的类
- php 页面执行时间计算代码
- php 页面执行时间计算代码
- php 计算代码执行时间
- php使用microtime(true)计算php程序代码执行消耗时间
- PHP 计算页面执行时间
- 计算执行的时间的代码