note 34208 added to function.microtime

From: Date: Fri, 18 Jul 2003 08:59:33 +0000
Subject: note 34208 added to function.microtime
Groups: php.notes 
Request: Send a blank email to php-notes+get-52331@lists.php.net to get a copy of this message
// 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! ---- Manual Page -- http://www.php.net/manual/en/function.microtime.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34208 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34208&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34208&report=yes

« previous php.notes (#52331) next »