note 110779 added to function.microtime
| From: | user5235235235 | Date: | Thu, 06 Dec 2012 17:58:57 +0000 |
| Subject: | note 110779 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-192377@lists.php.net to get a copy of this message | ||
Er, no. "final at skilled dot ch" failed to realised the two functions are being run at
different times, not simultaneously.
<?php
// These will both sometimes return true
print_r(time() < floor(microtime(true)));// Comparison 1
print_r(floor(microtime(true)) < time());// Comparison 2
// Yet these will never return true
print_r(floor(microtime(true)) > time());// Exactly the same as comparison 1, apart from running
order
print_r(time() > floor(microtime(true)));// Exactly the same as comparison 2, apart from running
order
?>
Remember folks, left-to-right for arithmetic (boolean, bitwise or otherwise) and right-to-left for
assignment.
----
Server IP: 69.147.83.199
Probable Submitter: 72.52.91.2 (proxied: 78.33.222.134)
----
Manual Page -- http://php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/110779
Del: integrated -- https://master.php.net/note/delete/110779/integrated
Del: useless -- https://master.php.net/note/delete/110779/useless
Del: bad code -- https://master.php.net/note/delete/110779/bad+code
Del: spam -- https://master.php.net/note/delete/110779/spam
Del: non-english -- https://master.php.net/note/delete/110779/non-english
Del: in docs -- https://master.php.net/note/delete/110779/in+docs
Del: other reasons-- https://master.php.net/note/delete/110779
Reject -- https://master.php.net/note/reject/110779
Search -- https://master.php.net/manage/user-notes.php