Skip to content

Instantly share code, notes, and snippets.

@0xnbk
Created September 13, 2010 04:37
Show Gist options
  • Save 0xnbk/576819 to your computer and use it in GitHub Desktop.
Save 0xnbk/576819 to your computer and use it in GitHub Desktop.
Calculate execution time
<?php
//Create a variable for start time
$time_start = microtime(true);
// Place your PHP/HTML/JavaScript/CSS/Etc. Here
//Create a variable for end time
$time_end = microtime(true);
//Subtract the two times to get seconds
$time = $time_end - $time_start;
echo 'Script took '.$time.' seconds to execute';
?>
@0xnbk
Copy link
Author

0xnbk commented Sep 13, 2010

Calculate execution time

For debugging purposes, it is a good thing to be able to calculate the execution time of a script. This is exactly what this piece of code can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment