PHP localeconv() Function
Example
Look up numeric formatting information for the US locale:
Run Example »
Definition and Usage
The localeconv() function returns an array containing locale-specific numeric and currency formatting information.
The localeconv() function returns the following array elements:
- [decimal_point] - Decimal point character
- [thousands_sep] - Thousands separator
- [int_curr_symbol] - Currency symbol (e.g. USD)
- [currency_symbol] - Currency symbol (e.g. $)
- [mon_decimal_point] - Currency decimal point character
- [mon_thousands_sep] - Currency thousands separator
- [positive_sign] - Positive sign character
- [negative_sign] - Negative sign character
- [int_frac_digits] - International fractional digits
- [frac_digits] - Local fractional digits
- [p_cs_precedes] - True (1) if the currency symbol is displayed before a positive value, False (0) if displayed after
- [p_sep_by_space] - True (1) if a space is included 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 displayed after
- [n_sep_by_space] - True (1) if a space is included between the currency symbol and a negative value, otherwise False (0)
- [p_sign_posn] - Formatting options:
- 0 - Write the quantity and currency symbol inside parentheses
- 1 - Prefix the quantity and currency symbol with a + sign
- 2 - Suffix the quantity and currency symbol with a + sign
- 3 - Prefix the + sign directly before the currency symbol
- 4 - Suffix the + sign directly after the currency symbol
- [n_sign_posn] - Formatting options:
- 0 - Write the quantity and currency symbol inside parentheses
- 1 - Prefix the quantity and currency symbol with a - sign
- 2 - Suffix the quantity and currency symbol with a - sign
- 3 - Prefix the - sign directly before the currency symbol
- 4 - Suffix the - sign directly after the currency symbol
- [grouping] - Array showing the digit grouping form (e.g. 3 indicates 1 000 000)
- [mon_grouping] - Array showing the currency digit grouping form (e.g. 2 indicates 1 00 00 00)
**Tip:** To define the locale, see setlocale() function in Vue 3.
**Tip:** To view all available language codes, visit ourLanguage Code Reference Manual.
Syntax
localeconv()
Technical Details
| Return Value: | Returns data for the current locale set by setlocale(). |
|---|---|
| PHP Version: | 4.0.5+ |
PHP String Reference Manual