localeconv() – PHP String Functions
Syntax :
Description :
It’s an inbuilt function of PHP. localeconv() function will Get numeric formatting information.
Output :
localeconv() returns data based upon the current locale as set by setlocale(). The associative array that is returned contains the following fields:
[table caption=”List of available flags constants are” max-width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Array Element, Description
[decimal_point], Decimal point character
[thousands_sep], Thousands separator
[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
[positive_sign], Handle code as HTML 5.
[positive_sign], Sign for positive values
[negative_sign], Sign for negative values
[int_frac_digits],International fractional digits
[frac_digits],Local fractional digits
[p_cs_precedes],TRUE if currency_symbol precedes a positive value FALSE if it succeeds one
[p_sep_by_space], TRUE if a space separates currency_symbol from a positive value otherwise FALSE
[n_cs_precedes] , TRUE if currency_symbol precedes a negative value FALSE if it succeeds one
[n_sep_by_space] , TRUE if a space separates currency_symbol from a negative value otherwise FALSE otherwise
[p_sign_posn],
,0 – Parentheses surround the quantity and currency_symbol
,1 – The sign string precedes the quantity and currency_symbol
,2 – The sign string succeeds the quantity and currency_symbol
,3 – The sign string immediately precedes the currency_symbol
,4 – The sign string immediately succeeds the currency_symbol
[n_sign_posn],
,0 – Parentheses surround the quantity and currency_symbol
,1 – The sign string precedes the quantity and currency_symbol
,2 – The sign string succeeds the quantity and currency_symbol
,3 – The sign string immediately precedes the currency_symbol
,4 – The sign string immediately succeeds the currency_symbol
[/table]
Related articles : stripos(), strpos(), strripos().
localeconv() – PHP Functions Example 1 :
<?php setlocale(LC_ALL,"US"); $str_locale = localeconv(); print_r($str_locale); ?>
Output of above code in the browser is as below:
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] =>
[currency_symbol] =>
[mon_decimal_point] =>
[mon_thousands_sep] =>
[positive_sign] =>
[negative_sign] =>
[int_frac_digits] => 127
[frac_digits] => 127
[p_cs_precedes] => 127
[p_sep_by_space] => 127
[n_cs_precedes] => 127
[n_sep_by_space] => 127
[p_sign_posn] => 127
[n_sign_posn] => 127
[grouping] => Array
(
)
[mon_grouping] => Array
(
)
)