note 27994 added to function.microtime

From: Date: Sat, 28 Dec 2002 23:29:46 +0000
Subject: note 27994 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-41400@lists.php.net to get a copy of this message
shorter version of function to get difference between two microtimes: function microtime_diff($a, $b) { list($a_dec, $a_sec) = explode(" ", $a); list($b_dec, $b_sec) = explode(" ", $b); return $b_sec - $a_sec + $b_dec - $a_dec; } Use as follows: $start_time = microtime(); /* ... do your processing here ... */ $duration = microtime_diff($start_time, microtime()); $duration = sprintf("%0.3f", $duration); echo ("Processing took $duration seconds"); -- http://www.php.net/manual/en/function.microtime.php http://master.php.net/manage/user-notes.php?action=edit+27994 http://master.php.net/manage/user-notes.php?action=delete+27994 http://master.php.net/manage/user-notes.php?action=reject+27994

« previous php.notes (#41400) next »