note 83107 added to function.microtime
| From: | carbolymer at o2 dot pl | Date: | Sat, 10 May 2008 09:22:08 +0000 |
| Subject: | note 83107 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139233@lists.php.net to get a copy of this message | ||
to: blue at ba7rain dot net
Instead of:
<?php
function GetMicro(){
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
?>
You can simply use:
<?php
microtime(true);
?>
Which gives the same effect. I don't know why that argument is not mentioned here.
Example:
<?php
$i = microtime(true);
sleep(1);
echo microtime(true)-$i;
/*
-- output --
0.99996805191
-- output --
*/
?>
Thanks to xk.
----
Server IP: 82.177.164.100
Probable Submitter: 83.25.93.118
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/83107
Del: integrated -- https://master.php.net/note/delete/83107/integrated
Del: useless -- https://master.php.net/note/delete/83107/useless
Del: bad code -- https://master.php.net/note/delete/83107/bad+code
Del: spam -- https://master.php.net/note/delete/83107/spam
Del: non-english -- https://master.php.net/note/delete/83107/non-english
Del: in docs -- https://master.php.net/note/delete/83107/in+docs
Del: other reasons-- https://master.php.net/note/delete/83107
Reject -- https://master.php.net/note/reject/83107
Search -- https://master.php.net/manage/user-notes.php