开发者

Get the currency of a locale [duplicate]

开发者 https://www.devze.com 2023-03-26 15:37 出处:网络
This question already has an answer here: 开发者_高级运维Closed 11 years ago. Possible Duplicate:
This question already has an answer here: 开发者_高级运维 Closed 11 years ago.

Possible Duplicate:

How to get the default currency from the PHP Intl ( ICU library )

I am using the intl extension in php to deal with localizing the content and formatting things. Since I already know the locale such as en_US, is it possible to get the currency of the locale from PHP?

I should get $ or USD if locale is en_US and $ or AUD if locale is en_AU.

I need to get the 3-letter ISO 4217 currency code to pass into numberFormatter::Currency.

Thanks :)


The localeconv() function will give you a number of useful facts about the current locale, including the international currency symbol (as int_curr_symbol).

If the locale you're interested in isn't set as the current locale, you'll have to temporarily switch to it using setlocale().

0

精彩评论

暂无评论...
验证码 换一张
取 消