欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-13 20:14:04
...
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";

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/632500.htmlTechArticlefunction getmicrotime(){ list($usec, $sec) = explode( ,microtime()); return ((float)$usec (float)$sec); } $time_start = getmicrotime();//开始计时, 放在程序头 for ($i=0; $i...