asCurrency() public method
Formats the value as a currency number.
This function does not require the PHP intl extension to be installed to work, but it is highly recommended to install it to get good formatting results.
| public string asCurrency ( $value, $currency = null, $options = [], $textOptions = [] ) | ||
|---|---|---|
| $value | mixed |
The value to be formatted. |
| $currency | string |
The 3-letter ISO 4217 currency code indicating the currency to use. If null, $currencyCode will be used. |
| $options | array |
Optional configuration for the number formatter. This parameter will be merged with $numberFormatterOptions. |
| $textOptions | array |
Optional configuration for the number formatter. This parameter will be merged with $numberFormatterTextOptions. |
| return | string |
The formatted result. |
| throws | yii\base\InvalidParamException |
if the input value is not numeric or the formatting failed. |
| throws | yii\base\InvalidConfigException |
if no currency is given and $currencyCode is not defined. |
Please login to continue.