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()
.
精彩评论