I'm trying to use money_format in PHP to get this result: $100,000.00 USD if that is possible.

Here is what I have:

$cost = 100000;
$usd = money_format('%i', $cost);

This is what I get:

USD 100,000.00

What I would like is:

$100,000.00 USD

I may be adding other currencies later, so if the solution breaks the general utility and l10n of money_format then I won't use it and will just use the default value.

有帮助吗?

解决方案

i prefer number_format()

$usd =  '$'.number_format($number, 2, '.', ',').' USD';
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top