MIOLO20
Tudo Estruturas de dados Namespaces Ficheiros Funções Variáveis
Referência ao namespace currency

Descrição detalhada

Handles the formatting of monetary amounts according to different formatting styles.

An amount can be formatted according to a given style, or to the style for a given ISO 4217 currency code (eg. AUD).

The class can also be used to validate currency amounts according to a particular formatting style, and to convert a formatted string to a double amount.

Example usage:


$cf = new CurrencyFormatter();

$formattedAmount = $cf->format(1234.56, "ESP"); // $formattedAmount is now == "1.234,56 Ptas"

$formattedAmount = $cf->format(1234.56, "GBP"); // $formattedAmount is now == "£1.234,56"

$decimal = $cf->toDecimal("1.234,56 Ptas"); // $decimal is now == 1234.56;

$isValid = $cf->validate("1.234,56 Ptas", "ESP"); // $isValid is now == true $isValid = $cf->validate("1.234,56", "ESP"); // $isValid is now == true $isValid = $cf->validate("1,234.56 Ptas", "ESP"); // $isValid is now == false


Autor
Simon Wade simon.nosp@m.vwad.nosp@m.e@yah.nosp@m.oo.c.nosp@m.om
Versão
Id
CurrencyFormatter.inc,v 1.1.1.1 2001/08/13 07:48:35 simonw Exp

@access public