0

Amount does not match value

Tested. Opnserver.

PHP 7.1.12 (cli) (built: Nov 23 2017 04:34:08) ( ZTS MSVC14 (Visual C++ 2015) x86 )

Or in tested http://www.writephponline.com/

    $loc=6084.87+7764.25+403.88+149.0;
    var_dump($loc);
    $summI=(float)"14402.00";
    var_dump($summI==$loc);    
Rp9
  • 1,955
  • 2
  • 23
  • 31
  • One way to workaround the issue is to use `number_format()`: https://3v4l.org/q7YMR – catcon Oct 21 '19 at 05:35
  • Comparing floats with == operator is not the right way. use abs($a-$b) < 0.000001 )(or PHP_FLOAT_EPSILON constant). see for example: https://stackoverflow.com/questions/3148937/compare-floats-in-php – Ali Khalili Oct 21 '19 at 05:51
  • Thanks. Official documentation [link](https://www.php.net/manual/ru/language.types.float.php) – Leonid Kim Oct 23 '19 at 04:41

0 Answers0