Php localeconv
From w3cyberlearnings
Contents |
PHP function localeconv
This function returns information containing monetary and local numeric formatting as a array. You can use setlocale() function to specifies the local
Syntax localeconv
localeconv();
Return description
- array[ decimal_point ] : decimal point character
- array[ thousands_sep ] : thousands separtor
- array[ int_curr_symbol ] : currency symbol (USD)
- array[ currency_symbol ] : currency symbol ($)
- array[ mon_decimal_point ] : monetary decimal point character
- array[ mon_thousands_sep ] : monetary decimal thousands separator
- array[ positive_sign ] : positive value character
- arrat[ negative_sign ] : nagative value character
- array[ int_frac_digits ] : international fractional digits
- array[ frac_digits] : local fractional digits
- array[ p_cs_precedes] : TRUE if currency_symbol precedes a positive value, FALSE if it succeeds one
- array[ p_sep_by_space] : TRUE if a space separates currency_symbol from a positive value, FALSE otherwise
- array[ n_cs_precedes] : TRUE if currency_symbol precedes a negative value, FALSE if it succeeds one
- array[ n_sep_by_space] : TRUE if a space separates currency_symbol from a negative value, FALSE otherwise
- array[ 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
- array[ 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
- array[ grouping] > Array() : Array displaying how numbers are grouped (example: 2 indicates: 1 00 00 00).
- array[ mon_grouping] > Array():Array displaying how monetary numbers are grouped (example: 2 indicates: 1 00 00 00)
Example 1
<?php $infor = localeconv(); print_r($infor); ?>
Output
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 ( ) )
Example 2:
- Set to Hebraw locale numeric formatting.
<?php setlocale(LC_ALL, 'HEB'); $infor = localeconv(); print_r($infor); ?>
Output
Array ( [decimal_point] => . [thousands_sep] => , [int_curr_symbol] => ILS [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] => 0 [p_sign_posn] => 4 [n_sign_posn] => 4 [grouping] => Array ( [0] => 3 ) [mon_grouping] => Array ( [0] => 3 ) )