money: Problems with string casting and locales that use comma as separator
Triying to do something similar to this:
$money = Money::EUR(100);
$percentage = $money->multiply(10 / 100);
$result = $money->subtract($percentage);
but it returns 0€ for $percentage. Any clue? The system does have the bcmath extension loaded.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 20 (10 by maintainers)
Commits related to this issue
- Fix comparing of decimal numbers, fixes #352 and #358 - Fix comparing of decimal numbers - Fixes #352 and #358. - Added solutions for both BCMath and GMP. — committed to moneyphp/money by frederikbosch 7 years ago
@Surt PR #361 will solve the issue.
Cool. Thanks.
http://php.net/manual/en/function.sprintf.php F - the argument is treated as a float, and presented as a floating-point number (non-locale aware). Available since PHP 5.0.3.
so, “%.8F” seems to be the way to go.
@Surt I will take care of this. You can expect fixes tomorrow.