Skip to content

Instantly share code, notes, and snippets.

@sftsk
Created March 17, 2015 13:59
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 sftsk/59aedefa486f87c05eac to your computer and use it in GitHub Desktop.
Save sftsk/59aedefa486f87c05eac to your computer and use it in GitHub Desktop.
Measure how long something takes in php
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$start = $time;
// do something in here
$time = microtime();
$time = explode(' ', $time);
$time = $time[1] + $time[0];
$finish = $time;
$total_time = round(($finish - $start), 4);
error_log('took '.$total_time.' seconds.');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment