Format Types
These styles are used by the numfmt_create to define the type of the formatter. NumberFormatter::PATTERN_DECIMALintDecimal format defined by patternNumberFormatter::DECIMALintDecimal formatNumberFormatter::DECIMAL_COMPACT_SHORTintDecimal format expressed using compact notation (short form), e.g. "23K", "45B". Available as of PHP 8.5.0 and ICU 56.NumberFormatter::DECIMAL_COMPACT_LONGintDecimal format expressed using compact notation (long form), e.g. "23 thousand", "45 billion". Available as of PHP 8.5.0 and ICU 56.NumberFormatter::CURRENCYintCurrency formatNumberFormatter::CURRENCY_ISOintISO currency format (e.g., "USD1.00"). Available as of PHP 8.5.0.NumberFormatter::CURRENCY_PLURALintPluralized currency format (e.g., "1.00 US dollar" and "3.00 US dollars"). Available as of PHP 8.5.0.NumberFormatter::CASH_CURRENCYintCurrency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23". Available as of PHP 8.5.0 and ICU 54NumberFormatter::CURRENCY_STANDARDintCurrency symbol, e.g., "$1.00", using non-accounting style for negative values (e.g. minus sign). Available as of PHP 8.5.0 and ICU 56.NumberFormatter::PERCENTintPercent formatNumberFormatter::SCIENTIFICintScientific formatNumberFormatter::SPELLOUTintSpellout rule-based formatNumberFormatter::ORDINALintOrdinal rule-based formatNumberFormatter::DURATIONintDuration rule-based formatNumberFormatter::PATTERN_RULEBASEDintRule-based format defined by patternNumberFormatter::CURRENCY_ACCOUNTINGint Currency format for accounting, e.g., ($3.00) for negative currency amount instead of -$3.00. Available as of PHP 7.4.1 and ICU 53. NumberFormatter::DEFAULT_STYLEintDefault format for the localeNumberFormatter::IGNOREintAlias for PATTERN_DECIMAL
Predefined Constants
Format Types
These styles are used by the numfmt_create() to define the type of the formatter.
NumberFormatter::PATTERN_DECIMALintDecimal format defined by pattern
NumberFormatter::DECIMALintDecimal format
NumberFormatter::DECIMAL_COMPACT_SHORTintDecimal format expressed using compact notation (short form), e.g. "23K", "45B". Available as of PHP 8.5.0 and ICU 56.
NumberFormatter::DECIMAL_COMPACT_LONGintDecimal format expressed using compact notation (long form), e.g. "23 thousand", "45 billion". Available as of PHP 8.5.0 and ICU 56.
NumberFormatter::CURRENCYintCurrency format
NumberFormatter::CURRENCY_ISOintISO currency format (e.g., "USD1.00"). Available as of PHP 8.5.0.
NumberFormatter::CURRENCY_PLURALintPluralized currency format (e.g., "1.00 US dollar" and "3.00 US dollars"). Available as of PHP 8.5.0.
NumberFormatter::CASH_CURRENCYintCurrency symbol given CASH usage, e.g., "NT$3" instead of "NT$3.23". Available as of PHP 8.5.0 and ICU 54
NumberFormatter::CURRENCY_STANDARDintCurrency symbol, e.g., "$1.00", using non-accounting style for negative values (e.g. minus sign). Available as of PHP 8.5.0 and ICU 56.
NumberFormatter::PERCENTintPercent format
NumberFormatter::SCIENTIFICintScientific format
NumberFormatter::SPELLOUTintSpellout rule-based format
NumberFormatter::ORDINALintOrdinal rule-based format
NumberFormatter::DURATIONintDuration rule-based format
NumberFormatter::PATTERN_RULEBASEDintRule-based format defined by pattern
NumberFormatter::CURRENCY_ACCOUNTINGintCurrency format for accounting, e.g.,
($3.00)for negative currency amount instead of-$3.00. Available as of PHP 7.4.1 and ICU 53.NumberFormatter::DEFAULT_STYLEintDefault format for the locale
NumberFormatter::IGNOREintAlias for PATTERN_DECIMAL
Number Format Specifiers
These constants define how the numbers are parsed or formatted. They should be used as arguments to numfmt_format() and numfmt_parse().
NumberFormatter::TYPE_DEFAULTintDerive the type from variable type
NumberFormatter::TYPE_INT32intFormat/parse as 32-bit integer
NumberFormatter::TYPE_INT64intFormat/parse as 64-bit integer
NumberFormatter::TYPE_DOUBLEintFormat/parse as floating point value
NumberFormatter::TYPE_CURRENCYintFormat/parse as currency value. Deprecated as of PHP 8.3.0
Number Format Attributes
Number format attribute used by numfmt_get_attribute() and numfmt_set_attribute().
NumberFormatter::PARSE_INT_ONLYintParse integers only.
NumberFormatter::GROUPING_USEDintUse grouping separator.
NumberFormatter::DECIMAL_ALWAYS_SHOWNintAlways show decimal point.
NumberFormatter::MAX_INTEGER_DIGITSintMaximum integer digits.
NumberFormatter::MIN_INTEGER_DIGITSintMinimum integer digits.
NumberFormatter::INTEGER_DIGITSintInteger digits.
NumberFormatter::MAX_FRACTION_DIGITSintMaximum fraction digits.
NumberFormatter::MIN_FRACTION_DIGITSintMinimum fraction digits.
NumberFormatter::FRACTION_DIGITSintFraction digits.
NumberFormatter::MULTIPLIERintMultiplier.
NumberFormatter::GROUPING_SIZEintGrouping size.
NumberFormatter::ROUNDING_MODEintRounding Mode.
NumberFormatter::ROUNDING_INCREMENTintRounding increment.
NumberFormatter::FORMAT_WIDTHintThe width to which the output of format() is padded.
NumberFormatter::PADDING_POSITIONintThe position at which padding will take place. See pad position constants for possible argument values.
NumberFormatter::SECONDARY_GROUPING_SIZEintSecondary grouping size.
NumberFormatter::SIGNIFICANT_DIGITS_USEDintUse significant digits.
NumberFormatter::MIN_SIGNIFICANT_DIGITSintMinimum significant digits.
NumberFormatter::MAX_SIGNIFICANT_DIGITSintMaximum significant digits.
NumberFormatter::LENIENT_PARSEintLenient parse mode used by rule-based formats.
Number Format Text Attributes
Number format text attribute used by numfmt_get_text_attribute() and numfmt_set_text_attribute().
NumberFormatter::POSITIVE_PREFIXintPositive prefix.
NumberFormatter::POSITIVE_SUFFIXintPositive suffix.
NumberFormatter::NEGATIVE_PREFIXintNegative prefix.
NumberFormatter::NEGATIVE_SUFFIXintNegative suffix.
NumberFormatter::PADDING_CHARACTERintThe character used to pad to the format width.
NumberFormatter::CURRENCY_CODEintThe ISO currency code.
NumberFormatter::DEFAULT_RULESETintThe default rule set. This is only available with rule-based formatters.
NumberFormatter::PUBLIC_RULESETSintThe public rule sets. This is only available with rule-based formatters. This is a read-only attribute. The public rulesets are returned as a single string, with each ruleset name delimited by ';' (semicolon).
Symbol Format Specifiers
Number format symbols used by numfmt_get_symbol() and numfmt_set_symbol().
NumberFormatter::DECIMAL_SEPARATOR_SYMBOLintThe decimal separator.
NumberFormatter::GROUPING_SEPARATOR_SYMBOLintThe grouping separator.
NumberFormatter::PATTERN_SEPARATOR_SYMBOLintThe pattern separator.
NumberFormatter::PERCENT_SYMBOLintThe percent sign.
NumberFormatter::ZERO_DIGIT_SYMBOLintZero.
NumberFormatter::DIGIT_SYMBOLintCharacter representing a digit in the pattern.
NumberFormatter::MINUS_SIGN_SYMBOLintThe minus sign.
NumberFormatter::PLUS_SIGN_SYMBOLintThe plus sign.
NumberFormatter::CURRENCY_SYMBOLintThe currency symbol.
NumberFormatter::INTL_CURRENCY_SYMBOLintThe international currency symbol.
NumberFormatter::MONETARY_SEPARATOR_SYMBOLintThe monetary separator.
NumberFormatter::EXPONENTIAL_SYMBOLintThe exponential symbol.
NumberFormatter::PERMILL_SYMBOLintPer mill symbol.
NumberFormatter::PAD_ESCAPE_SYMBOLintEscape padding character.
NumberFormatter::INFINITY_SYMBOLintInfinity symbol.
NumberFormatter::NAN_SYMBOLintNot-a-number symbol.
NumberFormatter::SIGNIFICANT_DIGIT_SYMBOLintSignificant digit symbol.
NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOLintThe monetary grouping separator.
Rounding Modes
Rounding mode values used by numfmt_get_attribute() and numfmt_set_attribute() with NumberFormatter::ROUNDING_MODE attribute.
NumberFormatter::ROUND_AWAY_FROM_ZEROAlias
NumberFormatter::ROUND_UP.NumberFormatter::ROUND_CEILINGintRounding mode to round towards positive infinity.
NumberFormatter::ROUND_DOWNintRounding mode to round towards zero.
NumberFormatter::ROUND_FLOORintRounding mode to round towards negative infinity.
NumberFormatter::ROUND_HALFDOWNintRounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round down.
NumberFormatter::ROUND_HALFEVENintRounding mode to round towards the "nearest neighbor" unless both neighbors are equidistant, in which case, round towards the even neighbor.
NumberFormatter::ROUND_HALFODDRounding mode to round towards the "odd neighbor".
NumberFormatter::ROUND_HALFUPintRounding mode to round towards "nearest neighbor" unless both neighbors are equidistant, in which case round up.
NumberFormatter::ROUND_TOWARD_ZEROAlias
NumberFormatter::ROUND_DOWN.NumberFormatter::ROUND_UPintRounding mode to round away from zero.
Padding Specifiers
Pad position values used by numfmt_get_attribute() and numfmt_set_attribute() with NumberFormatter::PADDING_POSITION attribute.
NumberFormatter::PAD_AFTER_PREFIXintPad characters inserted after the prefix.
NumberFormatter::PAD_AFTER_SUFFIXintPad characters inserted after the suffix.
NumberFormatter::PAD_BEFORE_PREFIXintPad characters inserted before the prefix.
NumberFormatter::PAD_BEFORE_SUFFIXintPad characters inserted before the suffix.