php中如何计算程序运行时间
<?php
//程序运行时间
$starttime = explode(' ',microtime());
echo microtime;
/*········以下是代码区·········*/
for($i=0;$i<1000000;$i++)//这里是计算循环一百万次所需要的时间为:0.116秒。
{ $i;
}
/*········以上是代码区·········*/
//程序运行时间
$endtime = explode(' ',microtime());
$thistime = $endtime[0]+$endtime[1]-($starttime[0]+$starttime[1]);
$thistime = round($thistime,3);
echo "本网页执行耗时:".$thistime." 秒。".time;
?>
3.输出:本网页执行耗时:2.748 秒。