Current Location: Home> Function Categories> localeconv

localeconv

Get digital format information
Name:localeconv
Category:String
Programming Language:php
One-line Description:Returns local digital and currency format information.

Definition and usage

localeconv() function returns an array containing local numeric and currency format information.

localeconv() function returns the following array elements:

  • [decimal_point] - decimal character
  • [thousands_sep] - Thousands Separator
  • [int_curr_symbol] - Currency symbol (for example: USD)
  • [currency_symbol] - currency symbol (example: $)
  • [mon_decimal_point] - currency decimal character
  • [mon_thousands_sep] - Currency Thousands Separator
  • [positive_sign] - positive character
  • [negative_sign] - Negative value characters
  • [int_frac_digits] - Internationally universal decimal places
  • [frac_digits] - Local universal decimal places
  • [p_cs_precedes] - True(1) if the currency symbol is displayed before a positive value, False(0) if it is displayed after a positive value
  • [p_sep_by_space] - True(1) if there is a space between the currency symbol and a positive value, otherwise False(0)
  • [n_cs_precedes] - True(1) if the currency symbol is displayed before a negative value, False(0) if it is displayed after a negative value
  • [n_sep_by_space] - True(1) if there is a space between the currency symbol and a negative value, otherwise False(0)
  • [p_sign_posn] - Format options:
    • 0 - Write quantity and currency symbols in parentheses
    • 1 - Add a + sign before the quantity and currency symbols
    • 2 - Add + after the quantity and currency symbols
    • 3 - Add + directly before the currency symbol
    • 4 - Add + sign directly after the currency symbol
  • [n_sign_posn] - Format options:
    • 0 - Write quantity and currency symbols in parentheses
    • 1 - Add - sign before quantity and currency symbols
    • 2 - Add the - number after the quantity and currency symbols
    • 3 - Add the - number directly before the currency symbol
    • 4 - Add the - number directly after the currency symbol
  • [grouping] - Display arrays in combination of numbers (for example: 3 indicates 1 000 000)
  • [mon_grouping] - Displays an array of currency numbers in the form of combinations (for example: 2 indicates 1 00 00 00)

Tip: To define local settings, see setlocale() function.

Tip: To refer to all available language codes, please visit our language code reference manual .

Example

Find digital formatting information in the United States:

 <?php
setlocale ( LC_ALL , "US" ) ;
$locale_info = localeconv ( ) ;
print_r ( $locale_info ) ;
?>

Try it yourself

grammar

 localeconv ( )
Similar Functions
Popular Articles