Home > Backend Development > PHP Tutorial > A function that calculates the running time of a php page

A function that calculates the running time of a php page

WBOY
Release: 2016-07-25 09:07:21
Original
711 people have browsed it
  1. /*

  2. Calculate php program running time
  3. */
  4. function microtime_float()
  5. {
  6. list($usec, $sec) = explode(" ", microtime( ));
  7. return ((float)$usec + (float)$sec);
  8. }

  9. //Start timing and put it on the head

  10. $starttime = microtime_float();
  11. / /End the timer and put it at the bottom
  12. $runtime = number_format((microtime_float() – $starttime), 4).'s';
  13. //Output
  14. echo 'RunTime:'.$runtime;
  15. ?>< /p>
Copy code


source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template