PHP money_format with currency symbol
How do you format a number with it's currency symbol the correct lo开发者_Go百科cation? Is it better to just allows the end user determine what their currency symbol is by typing it in?
u can use with LC_MONETARY
$number = 1234.56;
// let's print the international format for the en_US locale
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number) . "\n";
// USD 1,234.56
// Italian national format with 2 decimals`
setlocale(LC_MONETARY, 'it_IT');
echo money_format('%.2n', $number) . "\n";
// Eu 1.234,56
精彩评论