note 55899 added to function.microtime
| From: | php-general at lists dot php dot net | Date: | Tue, 16 Aug 2005 22:06:27 +0000 |
| Subject: | note 55899 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-93768@lists.php.net to get a copy of this message | ||
<?php
/**
* Simple function to replicate PHP 5 behaviour
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
// Sleep for a while
usleep(100);
$time_end = microtime_float();
//*****
//***** Use round with 4 spaces after the decimal for shorter times. The output would be 0.003
seconds
//*****
$time = round($time_end - $time_start, 4);
echo "Did nothing in $time seconds\n";
?>
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+55899
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55899&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+55899&report=yes
Search -- http://master.php.net/manage/user-notes.php