Elapsed microtime counter
Counts the elapsed seconds when doing some process.
Author:
Jonas John
License:
Public Domain
Language:
PHP
Created:
05/26/2006
Updated:
05/26/2006
Tags:
debug, time functions
// mt_get: returns the current microtime function mt_get(){ global $mt_time; list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } // mt_start: starts the microtime counter function mt_start(){ global $mt_time; $mt_time = mt_get(); } // mt_end: calculates the elapsed time function mt_end($len=4){ global $mt_time; $time_end = mt_get(); return round($time_end - $mt_time, $len); }