WEB开发笔记 www.chhua.com 每日练习 写一个PHP测试程序运行时间的类

 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35    starTime=$this->getMicTime(); } public function stop(){//获取结束时间$this->stopTime=$this->getMicTime(); } public function spent(){//计算程序持续时间 return round($this->stopTime-$this->starTime)*1000;//获取毫秒数 } } //举例$time=new runTime(); $time->star(); for ($i=1;$i<=1000;$i++){ echo("a"); } $time->stop(); echo$time->spent(); ?>