note 110359 deleted from function.microtime by danbrown
| From: | danbrown@php.net | Date: | Wed, 17 Oct 2012 21:20:00 +0000 |
| Subject: | note 110359 deleted from function.microtime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191375@lists.php.net to get a copy of this message | ||
Note Submitter: espertalhao04 at hotmail dot com
----
it happens due to time changes...
try this instead of your script:
for ($i = 0; $i < 1000000; $i++)
{
if (($t = time()) < floor($f = microtime(true))) {
echo "Time=$t Microtime=$f Iteration=$i<br>".PHP_EOL;
}
}
you till see that where it says "Iteration", it will start in a big number and then every
single number after it will be +1 the initial...
it MIGHT stop the +1 count and start again with another huge number...
this is because the time is different, and it takes a bit longer to do those iterations, so, it will
be bigger, the microtime...
since the microtime has .xxx, it will be higher...
for example:
5 and 5.000001
5.000001 is higher...
test here:
http://writecodeonline.com/php/
and here:
http://phptester.net/index.php?lang=en
don't test here:
http://sandbox.onlinephpfunctions.com/