php code exution time


/ Published in: PHP
Save to your folder(s)

This code is based on the ASP script posted by Lio. It will determine the time taken for a php script to execute correct to 0.000000000000001 seconds.


Copy this code and paste it in your HTML
  1. // put this at the top of the page
  2. $mtime = microtime();
  3. $mtime = explode(" ",$mtime);
  4. $mtime = $mtime[1] + $mtime[0];
  5. $starttime = $mtime;
  6.  
  7. // put other code and html in here
  8.  
  9. // put this code at the bottom of the page
  10. $mtime = microtime();
  11. $mtime = explode(" ",$mtime);
  12. $mtime = $mtime[1] + $mtime[0];
  13. $endtime = $mtime;
  14. $totaltime = ($endtime - $starttime);
  15. echo "This page was created in ".$totaltime." seconds";

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.