Copy the code The code is as follows:
//date:2011-08-05
class RunTime//Page execution time class
{
private $starttime;//Page start execution time
private $stoptime;/ /Page end execution time
private $spendtime;//Page execution time spent
function getmicrotime()//Get the floating point number that returns the current microseconds
{
list($usec,$sec)=explode(" ",microtime ());
return ((float)$usec + (float)$sec);
}
function start()//The page starts executing the function and returns the time when the page execution starts
{
$this->starttime= $this->getmicrotime();
}
function end()//Display the time of page execution
{
$this->stoptime=$this->getmicrotime();
$this->spendtime= $this->stoptime-$this->starttime;
//return round($this->spendtime,10);
}
function display()
{
//$this->end() ;
echo "
Running time:".round($this->spendtime,10)."Seconds
";The above has introduced the PHP code PHP code running time viewing class code sharing, including PHP code content. I hope it will be helpful to friends who are interested in PHP tutorials.