Linked Questions

Popular Questions

Using the formatCurrency() method on the NumberFormatter class with the CHF (Swiss Francs) currency is rounding amounts to the nearest nickel amount (0.05) for me.


$formatter = new \NumberFormatter('en_US', \NumberFormatter::CURRENCY);
echo $formatter->formatCurrency('12.34', 'CHF');



Notice that the numeric amount 12.34 rounds up to 12.35. At first, I thought potentially this was expected and a new way of handling money that I am unfamiliar with. Turns out, that is not how it is supposed to work. (

Why is it rounding up / down to the nearest nickel amount in PHP, and how can I fix it?

Related Questions