PHP localeconv() Function

Returns an associative array containing localized numeric and monetary formatting information.

array localeconv ( void )

Example -

The above example will output : -

Array
(
    [decimal_point] => .
    [thousands_sep] =>
    [int_curr_symbol] => EUR
    [currency_symbol] => €
    [mon_decimal_point] => ,
    [mon_thousands_sep] =>
    [positive_sign] =>
    [negative_sign] => -
    [int_frac_digits] => 2
    [frac_digits] => 2
    [p_cs_precedes] => 1
    [p_sep_by_space] => 1
    [n_cs_precedes] => 1
    [n_sep_by_space] => 1
    [p_sign_posn] => 1
    [n_sign_posn] => 2
    [grouping] => Array
        (
        )

    [mon_grouping] => Array
        (
            [0] => 3
            [1] => 3
        )

)

Return Values

The absolute value of number. If the argument number is of type float, the return type is also float, otherwise it is integer (as float usually has a bigger value range than integer).

  • [decimal_point] - Decimal point character
  • [thousands_sep] - Thousands separator
  • [int_curr_symbol] - Currency symbol (example: USD)
  • [currency_symbol] - Currency symbol (example: $)
  • [mon_decimal_point] - Monetary decimal point character
  • [mon_thousands_sep] - Monetary thousands separator
  • [positive_sign] - Positive value character
  • [negative_sign] - Negative value character
  • [int_frac_digits] - International fractional digits
  • [frac_digits] - Local fractional digits
  • [p_cs_precedes] - True (1) if currency symbol is placed in front of a positive value, False (0) if it is placed behind
  • [p_sep_by_space] - True (1) if there is a spaces between the currency symbol and a positive value, False (0) otherwise
  • [n_cs_precedes] - True (1) if currency symbol is placed in front of a negative value, False (0) if it is placed behind
  • [n_sep_by_space] - True (1) if there is a spaces between the currency symbol and a negative value, False (0) otherwise
  • [p_sign_posn] - Formatting options:
    • 0 - Parentheses surround the quantity and currency symbol
    • 1 - The + sign is placed in front of the quantity and currency symbol
    • 2 - The + sign is placed after the quantity and currency symbol
    • 3 - The + sign is placed immediately in front of the currency symbol
    • 4 - The + sign is placed immediately after the currency symbol
  • [n_sign_posn] - Formatting options:
    • 0 - Parentheses surround the quantity and currency symbol
    • 1 - The - sign is placed in front of the quantity and currency symbol
    • 2 - The - sign is placed after the quantity and currency symbol
    • 3 - The - sign is placed immediately in front of the currency symbol
    • 4 - The - sign is placed immediately after the currency symbol
  • [grouping] - Array displaying how numbers are grouped (example: 3 indicates 1 000 000)
  • [mon_grouping] - Array displaying how monetary numbers are grouped (example: 2 indicates 1 00 00 00)

The p_sign_posn, and n_sign_posn contain a string of formatting options. Each number representing one of the above listed conditions.

The grouping fields contain arrays that define the way numbers should be grouped. For example, the monetary grouping field for the nl_NL locale (in UTF-8 mode with the euro sign), would contain a 2 item array with the values 3 and 3. The higher the index in the array, the farther left the grouping is. If an array element is equal to CHAR_MAX, no further grouping is done. If an array element is equal to 0, the previous element should be used.