Bug #81168 [NEW]: microtime return variable's value is changing inside loop

From: Date: Fri, 18 Jun 2021 09:34:57 +0000
Subject: Bug #81168 [NEW]: microtime return variable's value is changing inside loop
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234481@lists.php.net to get a copy of this message
From: nikhiltiwari005 at gmail dot com Operating system: Linux PHP version: 8.0.7 Package: *General Issues Bug Type: Bug Bug description:microtime return variable's value is changing inside loop Description: ------------ <?php $arr = []; for ($i = 0; $i < 5000000; $i++) { $mct = microtime(true); $arr[$mct] = $mct; } print_r($arr); Expected result: ---------------- <?php $arr = []; for ($i = 0; $i < 5000000; $i++) { $mct = microtime(true); $arr[$mct] = $mct; } print_r($arr); // result Array ( [1624008537] => 1624008538 [1624008538] => 1624008538.6062 ) Key is diffrent and value is diffrent of same variable. -- Edit bug report at https://bugs.php.net/bug.php?id=81168&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=81168&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=81168&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=81168&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=81168&r=needscript Try newer version: https://bugs.php.net/fix.php?id=81168&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=81168&r=support Expected behavior: https://bugs.php.net/fix.php?id=81168&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=81168&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=81168&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=81168&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=81168&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=81168&r=dst IIS Stability: https://bugs.php.net/fix.php?id=81168&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=81168&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=81168&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=81168&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=81168&r=mysqlcfg

« previous php.bugs (#234481) next »