Home >Backend Development >PHP Tutorial >Introduction to functions for calculating PHP page running time_PHP tutorial

Introduction to functions for calculating PHP page running time_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:01:56715browse

A function that calculates the running time of a php page.

Copy code The code is as follows:

/*
@ Calculate php Program running time
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$ usec + (float)$sec);
}
//Start timing and place it at the top
$starttime = microtime_float();
//End timing and place it at the bottom
$runtime = number_format((microtime_float() – $starttime), 4).'s';
//Output
echo 'RunTime:'.$runtime;
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327955.htmlTechArticleA function that calculates the running time of a php page. Copy the code as follows: ?php /* @ Calculate the running time of the php program*/ function microtime_float() { list($usec, $sec) = explode(" ",...
Statement:
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
Previous article:php5.3 Notes_PHP TutorialNext article:php5.3 Notes_PHP Tutorial