note 34201 deleted from function.microtime by et
| From: | et@php.net | Date: | Wed, 23 Jul 2003 15:22:41 +0000 |
| Subject: | note 34201 deleted from function.microtime by et | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52491@lists.php.net to get a copy of this message | ||
Note Submitter: daniel141@yahoo.com
----
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('%.16', $time_end - $time_start);
echo 'Loaded in ' . $time . ' seconds';
Good luck!