An introduction to the function that calculates the running time of php pages

  • 2020-06-23 00:07:00
  • OfStack

1 function to calculate the elapsed time of php pages.

<?php
/*
@  To calculate php Program running time 
*/
function microtime_float()
{
list($usec, $sec) = explode( "   " , microtime());
return ((float)$usec + (float)$sec);
}
// Start the timer and put it in your head 
$starttime = microtime_float();
// Finish the timer and place it at the bottom 
$runtime = number_format((microtime_float()  �  $starttime), 4).'s';
// The output 
echo  ' RunTime:'.$runtime;
?>

Related articles: