2011-09-05 21 views
1

我想在PHP的intl擴展中使用NumberFormatter獲取本地化的貨幣符號。0位數的ICU CurrencyFormatter模式

由於NumberFormatter使用ICU,我正在查看此page

我寫了下面的代碼:

$currencyFormatter = new NumberFormatter('en_US', NumberFormatter::CURRENCY); 
$currencyFormatter->setPattern('¤'); 
echo $currencyFormatter->formatCurrency(0, 'USD'); 

現在的代碼工作,但即使我已經設置了模式只是貨幣符號,我總是會得到1位。

上面的代碼輸出

$0 

更改echo $currencyFormatter->formatCurrency(8, 'USD');$8給出。

有沒有我可以使用的模式,以便數字永遠不會顯示?

回答