Skip to content

Instantly share code, notes, and snippets.

@napolux
Last active October 21, 2016 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save napolux/90a619763c61767234b88060b7f878a5 to your computer and use it in GitHub Desktop.
Save napolux/90a619763c61767234b88060b7f878a5 to your computer and use it in GitHub Desktop.
Measure execution time of PHP code
<?php
$start = microtime(true);
// Your code starts here
$i = 0;
while($i < 5000000) {
$i++;
}
// Your cord ends here
$end = microtime(true);
echo "Execution time: " . number_format($end - $start,5,',','.') . " seconds";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment