Calculate execution time


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



Copy this code and paste it in your HTML
  1. //Create a variable for start time
  2. $time_start = microtime(true);
  3.  
  4. // Place your PHP/HTML/JavaScript/CSS/Etc. Here
  5.  
  6. //Create a variable for end time
  7. $time_end = microtime(true);
  8. //Subtract the two times to get seconds
  9. $time = $time_end - $time_start;
  10.  
  11. echo 'Script took '.$time.' seconds to execute';

URL: http://phpsnips.com/snippet.php?id=26

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.