测试php代码的运行时间

测试php代码的运行时间

<?php
    class TestTime{
        private $stime;
        private $etime;
        public function __construct(){
            $this->stime = microtime(true);
        }
        
        public function start(){
            $this->stime = microtime(true);
        }
        
        public function end(){
            $this->etime = microtime(true);
            echo round(($this->etime - $this->stime) * 1000,5).'毫秒';
            $this->start();
        }        
    }
?>

 

posted @ 2015-04-02 14:08  520php  阅读(586)  评论(0编辑  收藏  举报