note 27994 deleted from function.microtime by aidan

From: Date: Tue, 28 Sep 2004 12:08:25 +0000
Subject: note 27994 deleted from function.microtime by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77482@lists.php.net to get a copy of this message
Note Submitter: gordon at kanazawa-gu dot ac dot jp ---- 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");

« previous php.notes (#77482) next »