22

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

目前,我使用:

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

3 回答 3

47

严重地。那是旗帜:

$money = money_format("%!n", $money);
于 2011-07-05T18:31:12.477 回答
5

试试 number_format($money)

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

于 2011-07-05T18:31:19.793 回答
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
于 2017-08-19T05:42:19.780 回答