Reputation: 191
I have been looking all over the place, but only found the solution for:
12.58 format.
Which is not what I need.
Basically I'm looking to convert simple numbers into monetary numbers.
So if the number is 1, then it would show $0.01
10, then it would show $0.10
If 100, then $1
If 1000, then $10
If 1050, then $10.50
If 100040, then the format would change to $1,000.40
Any help would be appreciated.
Upvotes: 1
Views: 26
Reputation:
Use formatCurrency to format a currency:
$number = 1;
$fmt = numfmt_create( 'en_US', NumberFormatter::CURRENCY );
echo numfmt_format_currency($fmt, $number / 100, 'USD')."\n";
will output $0.01
Upvotes: 2