Home  >  Article  >  Backend Development  >  PHP calculates current program execution time

PHP calculates current program execution time

WBOY
WBOYOriginal
2016-07-25 08:48:11820browse
  1. $pagestartime=microtime();
  2. ?>
  3. Web page content
  4. ...
  5. ...
  6. $pageendtime = microtime();
  7. $starttime = explode(" ",$pagestartime);
  8. $endtime = explode(" ",$pageendtime);
  9. $totaltime = $endtime [0]-$starttime[0]+$endtime[1]-$starttime[1];
  10. $timecost = sprintf("%s",$totaltime);
  11. echo "Page running time: $timecost seconds";
  12. ?>
  13. Source: PHP Chinese website
Copy code


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:URL crawlerNext article:URL crawler