Bug #81168 [Opn->Nab]: microtime return variable's value is changing inside loop

From: Date: Fri, 18 Jun 2021 09:40:37 +0000
Subject: Bug #81168 [Opn->Nab]: microtime return variable's value is changing inside loop
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-234482@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81168&edit=1 ID: 81168 Updated by: nikic@php.net Reported by: nikhiltiwari005 at gmail dot com Summary: microtime return variable's value is changing inside loop -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Linux PHP Version: 8.0.7 Block user comment: N Private report: N New Comment: You can look forward to the PHP 8.1 release, where this script will spam you with messages of the type > Deprecated: Implicit conversion from float 1624009164.693986 to int loses precision telling you exactly what went wrong. Previous Comments: ------------------------------------------------------------------------ [2021-06-18 09:34:57] nikhiltiwari005 at gmail dot com 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 this bug report at https://bugs.php.net/bug.php?id=81168&edit=1

« previous php.bugs (#234482) next »