We can use following code for get $ mark and format money.
setlocale(LC_MONETARY, 'en_US.UTF-8');
$amount = money_format('%(#1n', $amount);
How to get euro symbol from php money_format?
i think this will work
setlocale(LC_MONETARY, 'nl_NL.UTF-8');
$amount = money_format('%(#1n', 20);
echo $amount;
Use this
setlocale(LC_MONETARY, 'nl_NL');
$amount = money_format('%(#1n', $amount);
A quite old thread but if some google here That worked even on a local MAMP
setlocale(LC_MONETARY, 'de_DE');
echo money_format('€ %!n', 1.620.56);
// € 1.620.56
You can use the HTML entity
"&euro";
Directly in your code
$amount = money_format('%(#1n', $amount) .htmlentities('€');
EDIT
Or you can use the ! flag %(#!1n' so you code will looks like
$amount = money_format('%(#!1n', $amount) .htmlentities('€');
You can see the following post
Hope this would help
Finally a Italy locale worked for me.
$amount = '1600.00';
setlocale(LC_MONETARY, 'it_IT.UTF-8');
$amount = money_format('%.2n', $amount);
echo str_replace('Eu','€',$amount);
This is an old thread but I felt it worth sharing a relevant solution as the top answer doesn't provide an actual solution. I found this whilst searching for Spanish LC_monetary so if, like me, you end up here you know have an answer.
I use the following wrapped in a function with the advantage that it handles zeros nicely (see example in calculations ). I use this in my calculators for a slicker accounting layout. This example is Spain but you can use whichever Euro area you prefer:
setlocale(LC_MONETARY, "en_ES");
function C_S($iv) {
if(in_array($iv, array(' ','',0)) ){return'<i>€</i>0.00';}
else{return str_replace('EU','<i>€</i>', money_format("%i", $iv));}
}
the italics are not necessary, I use them with css for alignment for finance style reports. Again, here for info.
to use:
echo C_S(1234);
$price = 880000;
echo number_format($price, 2, ',', '.');
input => 880000
output => 880.000,00
来源:https://stackoverflow.com/questions/16519923/php-money-format-for-euro