Punic APIs
  • Namespace
  • Class
  • Tree
  • Todo

Namespaces

  • Punic
    • Exception

Classes

  • Calendar
  • Comparer
  • Currency
  • Data
  • Language
  • Misc
  • Number
  • Phone
  • Plural
  • Territory
  • Unit

Exceptions

  • Exception

Class Currency

Currency-related stuff.

Namespace: Punic
Located at Currency.php

Methods summary

public static array
# getAllCurrencies( boolean $alsoUnused = false, boolean $alsoNotTender = false, string $locale = '' )

Returns all the currencies.

Returns all the currencies.

Parameters

$alsoUnused
Set to true to receive also currencies not currently used by any country, false otherwise
$alsoNotTender
Set to true to receive also currencies that aren't legal tender in any country
$locale
The locale to use. If empty we'll use the default locale set with \Punic\Data::setDefaultLocale().

Returns

array
Array keys are the currency code, array values are the currency name. It's sorted by currency values
public static string
# getName( string $currencyCode, null|number|string $quantity = null, string $locale = '' )

Returns the name of a currency given its code.

Returns the name of a currency given its code.

Parameters

$currencyCode
The currency code
$quantity

The quantity identifier. Allowed values:

  • `null` to return the standard name, not associated to any quantity
  • `number` to return the name following the plural rule for the specified quantity
  • string `'zero'|'one'|'two'|'few'|'many'|'other'` the plural rule
$locale
The locale to use. If empty we'll use the default locale set with \Punic\Data::setDefaultLocale().

Returns

string
Returns an empty string if $currencyCode is not valid, the localized currency name otherwise
public static string
# getSymbol( string $currencyCode, string $which = '', string $locale = '' )

Returns the name of a currency given its code.

Returns the name of a currency given its code.

Parameters

$currencyCode
The currency code
$which
Which symbol flavor do you prefer? 'narrow' for narrow symbols, 'alt' for alternative. Other values: standard/default symbol
$locale
The locale to use. If empty we'll use the default locale set with \Punic\Data::setDefaultLocale().

Returns

string
Returns an empty string if $currencyCode is not valid, the localized currency name otherwise
public static array
# getCurrencyHistoryForTerritory( string $territoryCode )

Return the history for the currencies used in a territory.

Return the history for the currencies used in a territory.

Parameters

$territoryCode
The territoy code

Returns

array

Return a list of items with these keys:

  • string `currency`: the currency code (always present)
  • string `from`: start date of the currency validity in the territory (not present if no start date) - Format is YYYY-MM-DD
  • string `to`: end date of the currency validity in the territory (not present if no end date) - Format is YYYY-MM-DD
  • bool `tender`: true if the currency was or is legal tender, false otherwise (always present)
public static string
# getCurrencyForTerritory( string $territoryCode )

Return the currency to be used in a territory.

Return the currency to be used in a territory.

Parameters

$territoryCode
The territoy code

Returns

string
Returns an empty string if $territoryCode is not valid or we don't have info about it, the currency code otherwise
Punic APIs API documentation generated by ApiGen