No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher une fonction PHP

NumberFormatter: : formatCurrency

numfmt_format_currency

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

NumberFormatter::formatCurrency -- numfmt_format_currencyFormat a currency value

PHP: NumberFormatter::formatCurrency - Manual Home of Manuel PHP  Contents Haut

Description

Object oriented style

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

Procedural style

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

Format the currency value according to the formatter rules.

PHP: NumberFormatter::formatCurrency - Manual Home of Manuel PHP  Contents Haut

Parameters

fmt

NumberFormatter object.

value

The numeric currency value.

currency

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

PHP: NumberFormatter::formatCurrency - Manual Home of Manuel PHP  Contents Haut

Return Values

String representing the formatted currency value, or FALSE on failure.

PHP: NumberFormatter::formatCurrency - Manual Home of Manuel PHP  Contents Haut

Examples

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";
?>

The above example will output:

1.234.567,89 €
1.234.567,89 RUR
1 234 567,89€
1 234 567,89р.

PHP: NumberFormatter::formatCurrency - Manual Home of Manuel PHP  Contents Haut

See Also

Find a PHP function
Error Infobrol

Can not display this page of the Infobrol website

Type of error (18-01)

Unknown format specifier "&"

Please try again in a few minutes…

Return to the home page




Steph