chovy
chovy

Reputation: 75804

format money in PHP so it is "$xxx.xx USD"

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.

Upvotes: 0

Views: 649

Answers (1)

user557846
user557846

Reputation:

i prefer number_format()

$usd =  '$'.number_format($number, 2, '.', ',').' USD';

Upvotes: 2

Related Questions