php代码效率测试

对于一个被加载的页面,而遇到会卡的原因 ,代码量大,为了减少一句话分析,就采用分段式判断。

从php手册了解到,使用microtime函数,具体方法可参见php手册对这函数的用法

定义get_execution_time函数

function get_execution_time()
{
static
$microtime_start = null;
if(
$microtime_start === null)
{
$microtime_start = microtime(true);
return
0.0;
}
return
microtime(true) - $microtime_start;
}

在需要测试的地方调用个这函数。输入进行对比较
echo get_execution_time();

没有这么多结果。简简单单,走好每一步路----belie8
posted @ 2016-06-14 16:38  绿尘枫  阅读(339)  评论(0编辑  收藏  举报