Home >php教程 >php手册 >怎么计算一个程序的执行时间

怎么计算一个程序的执行时间

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 09:53:291210browse

function getmicrotime(){
list($usec, $sec) = explode(" ",microtime());
return ((float)$usec (float)$sec);
}

$time_start = getmicrotime();//开始计时, 放在程序头

for ($i=0; $i //do nothing, 1000 times
}

$time_end = getmicrotime();//结束计时, 放在尾部
$time = $time_end - $time_start;

echo "Did nothing in $time seconds";

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn