note 110359 added to function.microtime
| From: | espertalhao04 at hotmail dot com | Date: | Mon, 15 Oct 2012 10:36:55 +0000 |
| Subject: | note 110359 added to function.microtime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191299@lists.php.net to get a copy of this message | ||
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/
----
Server IP: 69.147.83.199
Probable Submitter: 95.136.43.99
----
Manual Page -- http://www.php.net/manual/en/function.microtime.php
Edit -- https://master.php.net/note/edit/110359
Del: integrated -- https://master.php.net/note/delete/110359/integrated
Del: useless -- https://master.php.net/note/delete/110359/useless
Del: bad code -- https://master.php.net/note/delete/110359/bad+code
Del: spam -- https://master.php.net/note/delete/110359/spam
Del: non-english -- https://master.php.net/note/delete/110359/non-english
Del: in docs -- https://master.php.net/note/delete/110359/in+docs
Del: other reasons-- https://master.php.net/note/delete/110359
Reject -- https://master.php.net/note/reject/110359
Search -- https://master.php.net/manage/user-notes.php