NumberFormatter
php ÊÖ²á | ½Å±¾Ñ§Ìà | ½Å±¾±à³Ì | ÍøÕ¾±à³Ì | ϵͳ¹ÜÀí | ·þÎñÆ÷ÅäÖà | Êý¾Ý¿â¹ÜÀí | Php½Ì³Ì | python½Ì³Ì | ÕýÔò±í´ïʽ | Åú´¦Àí½Å±¾ | Centos½Ì³Ì | Linux»ù´¡½Ì³Ì

NumberFormatter::formatCurrency

numfmt_format_currency

(PHP 5 >= 5.3.0, PECL intl >= 1.0.0)

NumberFormatter::formatCurrency -- numfmt_format_currencyFormat a currency value

˵Ã÷

Object oriented style

string NumberFormatter::formatCurrency ( float $value , string $currency )

Procedural style

string numfmt_format_currency ( NumberFormatter $fmt , float $value , string $currency )

Format the currency value according to the formatter rules.

²ÎÊý

fmt

NumberFormatter object.

value

The numeric currency value.

currency

The 3-letter ISO 4217 currency code indicating the currency to use.

·µ»ØÖµ

String representing the formatted currency value.

·¶Àý

Example #1 numfmt_format_currency() example

<?php
$fmt 
numfmt_create'de_DE'NumberFormatter::CURRENCY );
echo 
numfmt_format_currency($fmt1234567.891234567890000"EUR")."\n";
echo 
numfmt_format_currency($fmt1234567.891234567890000"RUR")."\n";
$fmt numfmt_create'ru_RU'NumberFormatter::CURRENCY );
echo 
numfmt_format_currency($fmt1234567.891234567890000"EUR")."\n";
echo 
numfmt_format_currency($fmt1234567.891234567890000"RUR")."\n";
?>

Example #2 OO example

<?php
$fmt 
= new NumberFormatter'de_DE'NumberFormatter::CURRENCY );
echo 
$fmt->formatCurrency(1234567.891234567890000"EUR")."\n";
echo 
$fmt->formatCurrency(1234567.891234567890000"RUR")."\n";
$fmt = new NumberFormatter'ru_RU'NumberFormatter::CURRENCY );
echo 
$fmt->formatCurrency(1234567.891234567890000"EUR")."\n";
echo 
$fmt->formatCurrency(1234567.891234567890000"RUR")."\n";
?>

ÉÏÀý½«Êä³ö£º

1.234.567,89 €
1.234.567,89 RUR
1 234 567,89€
1 234 567,89§â.

²Î¼û


NumberFormatter
php ÊÖ²á | ½Å±¾Ñ§Ìà | ½Å±¾±à³Ì | ÍøÕ¾±à³Ì | ϵͳ¹ÜÀí | ·þÎñÆ÷ÅäÖà | Êý¾Ý¿â¹ÜÀí | Php½Ì³Ì | python½Ì³Ì | ÕýÔò±í´ïʽ | Åú´¦Àí½Å±¾ | Centos½Ì³Ì | Linux»ù´¡½Ì³Ì