note 34208 deleted from function.microtime by didou

From: Date: Mon, 29 Dec 2003 15:21:15 +0000
Subject: note 34208 deleted from function.microtime by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62641@lists.php.net to get a copy of this message
Note Submitter: daniel141@yahoo.com ---- // There was a typo in my last post, sorry. This code works :D Here's a fix if your getting odd numbers like this "2.0980834960938E-05 seconds" function getmicrotime(){ list($usec, $sec) = explode(" ",microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); // Code goes here... $time_end = getmicrotime(); $time = sprintf('%.16f', $time_end - $time_start); echo 'Loaded in ' . $time . ' seconds'; Good luck!

« previous php.notes (#62641) next »