Latest web development tutorials

PHP localeconv () function

PHP String Reference PHP String Reference

Examples

Find a local US number formatting information:

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

Running instance »

Definition and Usage

() Function returns a local number, and currency formatting information array localeconv.

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 (for example: $)
  • [Mon_decimal_point] - Monetary decimal point character
  • [Mon_thousands_sep] - Monetary thousands separator
  • [Positive_sign] - positive character
  • [Negative_sign] - Negative character
  • [Int_frac_digits] - International General decimals
  • [Frac_digits] - Local General decimals
  • [P_cs_precedes] - If the currency symbol before the value is displayed in a positive, compared to True (1), then if the positive value shows that compared False (0)
  • [P_sep_by_space] - If a positive value between the currency symbol and spaces, compared to True (1), otherwise False (0)
  • [N_cs_precedes] - If the currency symbol is displayed before a negative value, for the True (1), if the display after a negative value, for the False (0)
  • [N_sep_by_space] - if between the currency symbol and negative values ​​contain spaces, for the True (1), otherwise False (0)
  • [P_sign_posn] - formatting options:
    • 0 - the quantity and currency symbol written in parentheses
    • 1 - In front of the quantity and currency symbol plus the +
    • 2 - after the quantity and currency symbol plus the +
    • 3 - before the currency symbol plus direct number +
    • 4 - Direct plus + sign after the currency symbol
  • [N_sign_posn] - formatting options:
    • 0 - the quantity and currency symbol written in parentheses
    • 1 - In front of the quantity and currency symbol plus - No.
    • 2 - after the quantity and currency symbol plus - No.
    • 3 - directly before the currency symbol plus - No.
    • 4 - Direct plus after the currency symbol - No.
  • [Grouping] - Display number combination in the form of an array (for example: 3 directions 1 million)
  • [Mon_grouping] - Display number combination in the form of an array of money (for example: 2 indicates 1 million)

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

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


grammar

localeconv()

technical details

return value: Returns the current local data based setlocale () settings.
PHP version: 4.0.5+


PHP String Reference PHP String Reference