Documentation PHP

NumberFormatter::formatCurrency

numfmt_format_currency

(No version information available, might be only in CVS)

numfmt_format_currency — Format a currency value

Description

Object oriented style

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

Procedural style

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

Format the currency value according to the formatter rules.

Liste de paramètres

fmt

NumberFormatter object.

value

The numeric currency value.

currency

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

Valeurs de retour

String representing the formatted currency value.

Exemples

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

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

L'exemple ci-dessus va afficher :

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


Ceci n'est pas la documentation originale du langage de programmation php, pour y accéder visiter le site www.php.net

Support du web, outils, services, compteurs, scripts, générateurs et autres outils pour les webmasters gratuitement à 100%
Page générée en 0.024713 secondes.