note 110779 deleted from function.microtime by danbrown
| From: | danbrown@php.net | Date: | Thu, 06 Dec 2012 18:46:03 +0000 |
| Subject: | note 110779 deleted from function.microtime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192378@lists.php.net to get a copy of this message | ||
Note Submitter: user5235235235
----
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.