Home > Backend Development > PHP Tutorial > PHP code running time viewing class code sharing_PHP tutorial

PHP code running time viewing class code sharing_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:25:53
Original
913 people have browsed it

Copy 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 page execution time
{
$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

";
}
}
/*Call method
$timer=new Runtime();
$timer->start();

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/324049.htmlTechArticleCopy the code code 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...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template