NumberFormatter
class NumberFormatter
Replacement for PHP's native {@link \NumberFormatter} class.
The only methods currently supported in this class are:
- {@link __construct}
- {@link create}
- {@link formatCurrency}
- {@link format}
- {@link getAttribute}
- {@link getErrorCode}
- {@link getErrorMessage}
- {@link getLocale}
- {@link parse}
- {@link setAttribute}
Constants
Properties
protected int | $errorCode | The error code from the last operation. | |
protected string | $errorMessage | The error message from the last operation. |
Methods
No description
Static constructor.
Format a currency value.
Format a number.
Returns an attribute value.
Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value.
Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
Returns the formatter's locale.
Not supported. Returns the formatter's pattern.
Not supported. Returns a formatter symbol value.
Not supported. Returns a formatter text attribute value.
Not supported. Parse a currency number.
Parse a number.
Set an attribute.
Not supported. Set the formatter's pattern.
Not supported. Set the formatter's symbol.
Not supported. Set a text attribute.
Set the error to the default U_ZERO_ERROR.
Details
static NumberFormatter
create(string $locale = 'en', int $style = null, string $pattern = null)
Static constructor.
int
getErrorCode()
Returns formatter's last error code. Always returns the U_ZERO_ERROR class constant value.
string
getErrorMessage()
Returns formatter's last error message. Always returns the U_ZERO_ERROR_MESSAGE class constant value.
string
getLocale(int $type = Locale::ACTUAL_LOCALE)
Returns the formatter's locale.
The parameter $type is currently ignored.
bool|string
parseCurrency(string $value, string $currency, int $position = null)
Not supported. Parse a currency number.