0

I already know about php precision troubles, but I'm trying to understand this case, in this code:

$value = 100000000.00000001;

return $value;

it will return:

100000000

but if i take the same $value and save it into my database (decimal 20,8 column) it will save the right value (100000000.00000001). Is there any way to convert this value to a string so my php can return the correct value (as a string)?

  • It doesn't relate to `return`. https://3v4l.org/dfSd5 Yes, standard string notation works. – user3783243 Apr 19 '22 at 15:03
  • Also recommend to read [this](https://stackoverflow.com/questions/14587290/can-i-rely-on-php-php-ini-precision-workaround-for-floating-point-issue). – vee Apr 19 '22 at 16:11

0 Answers0