localeconv()
localeconv() — Get numeric formatting information.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Returns an associative array containing localized numeric and monetary formatting information.
Signature
localeconv(): array
Parameters
This function takes no parameters.
Return value
localeconv() returns data based upon the current locale as set by setlocale(). The associative array that is returned contains the following fields: Array element Description decimal_point Decimal point character thousands_sep Thousands separator grouping Array containing numeric groupings int_curr_symbol International currency symbol (i.e. USD) currency_symbol Local currency symbol (i.e. $) mon_decimal_point Monetary decimal point character mon_thousands_sep Monetary thousands separator mon_grouping Array containing monetary groupings positive_sign Sign for positive values negative_sign Sign for negative values int_frac_digits International fractional digits frac_digits Local fractional ...
Example
A runnable snippet:
if (false !== setlocale(LC_ALL, 'nl_NL.UTF-8@euro')) { $locale_info = localeconv(); print_r($locale_info); }
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 ) )
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page localeconv() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.