Bug #78492 [NEW]: Comparing Value from equation to 100

From: Date: Wed, 04 Sep 2019 14:30:55 +0000
Subject: Bug #78492 [NEW]: Comparing Value from equation to 100
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222553@lists.php.net to get a copy of this message
From: email at brunofaria dot pt Operating system: Windows 10 PHP version: 7.3.9 Package: *Math Functions Bug Type: Bug Bug description:Comparing Value from equation to 100 Description: ------------ I'm adding this numbers from an array with key[0]: array(4) { [0]=> array(2) { [0]=> string(4) "61.8" [1]=> string(11) " Poliéster" } [1]=> array(2) { [0]=> string(4) "20.1" [1]=> string(6) " Nylon" } [2]=> array(2) { [0]=> string(4) "11.4" [1]=> string(9) " Algodão" } [3]=> array(2) { [0]=> string(3) "6.7" [1]=> string(6) " Rayon" } } 61.8 + 20.1 + 11.4 + 6.7 = 100 Then I'm comparing to 100, Returns False. Test script: --------------- $value = 0; foreach ($array as $key) { $value += floatval ( preg_replace ('/\s+/', '', $key[0]) ) ; } if ($value == 100 ) { return true; } else { return false; } Expected result: ---------------- true Actual result: -------------- false -- Edit bug report at https://bugs.php.net/bug.php?id=78492&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78492&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78492&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78492&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78492&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78492&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78492&r=support Expected behavior: https://bugs.php.net/fix.php?id=78492&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78492&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78492&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78492&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78492&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78492&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78492&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78492&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78492&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78492&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78492&r=mysqlcfg

« previous php.bugs (#222553) next »