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.
intl
The 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.
intl
The 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