PHP localeconv() Function

Definition

The localeconv() function returns an array containing local numeric and monetary formatting information.

Syntax

PHP localeconv() Function has the following syntax.

localeconv()

Parameter

None

Return

PHP localeconv() Function returns data based upon the current locale as set by setlocale().

The associative array that is returned contains the following fields:

Array elementDescription
decimal_pointDecimal point character
thousands_sepThousands separator
groupingArray containing numeric groupings
int_curr_symbolInternational currency symbol (i.e. USD)
currency_symbolLocal currency symbol (i.e. $)
mon_decimal_pointMonetary decimal point character
mon_thousands_sepMonetary thousands separator
mon_groupingArray containing monetary groupings
positive_signSign for positive values
negative_signSign for negative values
int_frac_digitsInternational fractional digits
frac_digitsLocal fractional digits
p_cs_precedesTRUE if currency_symbol precedes a positive value, FALSE if it succeeds one
p_sep_by_spaceTRUE if a space separates currency_symbol from a positive value, FALSE otherwise
n_cs_precedesTRUE if currency_symbol precedes a negative value, FALSE if it succeeds one
n_sep_by_spaceTRUE if a space separates currency_symbol from a negative value, 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

Example

Find the United States locale numeric formatting information:


<?php/*www . j  a  v  a2s .  c  o m*/
setlocale(LC_ALL,"US");
$locale_info = localeconv();
print_r($locale_info);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions