Posted By

kotnik on 05/04/07


Tagged

php time


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

zingo
vali29
JimiJay
jprice
scottwf
Anber
nb109


php code exution time


 / Published in: PHP
 

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.

  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  

You need to login to post a comment.