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

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

WBOY
Release: 2016-06-13 09:53:29
Original
1194 people have browsed it

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";

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template