PHP显示没有货币文本的money_format

时间:2011-07-05 18:29:09

标签: php money-format

在PHP中,是否可以使用money_format显示货币而不显示货币或至少以缩写形式显示货币?

目前,我使用:

$money = "1234.56";
setlocale("LC_ALL", "de_DE");
$money = money_format("%n", $money);

3 个答案:

答案 0 :(得分:43)

<!/ P>

严重。那是旗帜:

$money = money_format("%!n", $money);

答案 1 :(得分:5)

尝试number_format($ money)

http://php.net/manual/en/function.number-format.php

答案 2 :(得分:0)

// this if for Malaysia  , you can check according to your locality

$number = new NumberFormatter($locale = 'ms_MS.utf8', NumberFormatter::DECIMAL);
    echo $nmuber->format($amount)."\n"; ## 20,00,00,00,000
// if this give error 
Class 'NumberFormatter' not found
// for this  you can do  you can do a
apt-get install php7.0-intl