Reputation: 55
I have this function:
money_format("%!n", $number);
This will output: 2200
How I have to edit my function to have: 2200.00 Thanks for the help!
Upvotes: 0
Views: 2590
Reputation: 465
in money format, use ".{numberOfDigits}" for the amount of digits after the separator:
money_format("%!.2n", $number);
or use number format, because you don't want the currency symbol anyway:
number_format($number, 2);
Upvotes: 2
Reputation: 46900
$number=2200;
setlocale(LC_MONETARY, 'en_US');
echo money_format("%.2n", $number); //2200.00
Upvotes: 2