Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.51 KB

information.md

File metadata and controls

60 lines (41 loc) · 1.51 KB

Information

Methods

getFullName()

Returns: string - a full name of a currency United States dollar.

getName()

Returns: string - a short name of a currency dollar.

getCode()

Returns: string - an ISO-code USD.

getNumCode()

Returns: string - a numeric code 840.

getSymbol([?int $index = null])

Parameters:

  1. [?int $index = null] (optional) - if there are more than one symbol (array of symbols), then you should pass an index of the array of symbols, otherwise the first one is taken.

Returns: string - a symbol $.

getPosition()

Returns: CurrencyPosition

getDisplay()

Returns: CurrencyDisplay

Usage

$usd = currency("USD");

$usd->getFullName();    // "United States dollar"
$usd->getName();        // "dollar"
$usd->getCode();        // "USD"
$usd->getNumCode();     // "840"
$usd->getSymbol();      // "$"
$usd->getSymbols();     // ["$"]
$usd->getPosition();    // CurrencyPosition::Start
$usd->getDisplay();     // CurrencyDisplay::Symbol)

getSymbol() takes an index as its first parameter only if there are more than one symbol for the currency.

use PostScripton\Money\Currency;

$currency = currency("EGP");

// ["£", "ج.م"]
$currency->getSymbol();     // "£"
$currency->getSymbol(1);    // "ج.م"

See about choosing a preferred symbol for a currency with multiple symbols as well.


📌 Back to the contents.