I want to turn a "dirty" figure into a properly written currency price. The input figure will be something like 23.99000 and I want to display 23,99 + the Euro symbol.
I use this:
$price = number_format($price, 2, ',', '')." €";
But the result will be 23,00 € instead of 23,99 €.
What am I getting wrong? Thanks!
Try something like this:
Output:
the
f
means it'll treat the string as a float, and format accordingly.Why not simply using round ?