How to obtain the corresponding LOCALE information via the currency symbol "CURRENCY".

Source: Internet
Author: User
Tags intl locale
This problem occurs for the following reasons:

There are international recharge business, the information is as follows:

MONEY:₱48.00 CURRENCY:PHP

Where money is the top-up amount (the amount of the current locale), the currency is the currency information that corresponds to the cash.

For the sake of accounting convenience all want to ₱48.00 convert money into the naked eye but recognize the floating-point information.

intlThe following code was developed using the official PHP extension:

$locale = ?$money  = '₱48.00';$currency = 'PHP';$fmt    = new NumberFormatter($locale, NumberFormatter::CURRENCY);$__     = $fmt->parseCurrency($money, $currency);var_dump($__)//$__ === false为转换失败,若为float 则转换成功

Only to meet locale the difficulties of information can not be obtained, and then intl locale to obtain the following:

$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);var_dump($locale);

But Accept_language is not the normal locale information.

So is there a way currency to getlocale

Reply content:

This problem occurs for the following reasons:

There are international recharge business, the information is as follows:

MONEY:₱48.00 CURRENCY:PHP

Where money is the top-up amount (the amount of the current locale), the currency is the currency information that corresponds to the cash.

For the sake of accounting convenience all want to ₱48.00 convert money into the naked eye but recognize the floating-point information.

intlThe following code was developed using the official PHP extension:

$locale = ?$money  = '₱48.00';$currency = 'PHP';$fmt    = new NumberFormatter($locale, NumberFormatter::CURRENCY);$__     = $fmt->parseCurrency($money, $currency);var_dump($__)//$__ === false为转换失败,若为float 则转换成功

Only to meet locale the difficulties of information can not be obtained, and then intl locale to obtain the following:

$locale = Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']);var_dump($locale);

But Accept_language is not the normal locale information.

So is there a way currency to getlocale

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.