Table of Contents

Syntax

array localeconv()

(PHP 4, PHP 5)

RETURNS An associative array containing currency settings for the current locale.

What it Does

Retrieves an associative array containing all of the currency settings as defined by the current locale. These settings include the following:

decimal_point Decimal point character.
thousands_sep The character used to separate thousands (3 digits)
grouping
int_curr_symbol The symbol used to identify this currency internationally
currency_symbol A local symbol used to identify (a currency sign)
mon_decimal_point Monetary decimal point character.
mon_grouping Array containing monetary groupings.
positive_sign The character used to indicate a positive currency amount.
negative_sign The character used to indicate a negative currency amount.
int_frac_digits Number of digits used internationally to create fractional currency amounts.
frac_digits Number of digits used locally to create fractional currency amounts.
p_cs_precedes Does the currency symbol precede the amount (TRUE) or not (FALSE).
p_sep_by_space TRUE if a space separates the currency symbol from a negative value.
n_cs_precedes Does the currency symbol precede a negative value (TRUE) or not (FALSE).
n_sep_by_space Is the currency symbol separted from the amount by a space (TRUE) or not (FALSE).
p_sign_pos How to handle positive currency amounts. This may be one of the following

0 - Place parentheses around the amount and the currency symbol
1 - A sign string precedes the quantity and currency symbol
2 - The sign string succeeds the amount and currency symbol
3 - A sign string precedes the currency symbol
4 - A sign string succeeds the currency symbol
n_sign_pos How to handle negative currency amounts. This may be one of the following

0 - Place parentheses around the amount and the currency symbol
1 - A sign string precedes the quantity and currency symbol
2 - The sign string succeeds the amount and currency symbol
3 - A sign string precedes the currency symbol
4 - A sign string succeeds the currency symbol

Example

// set the locale and get the currency settings
if (setlocale(LC_ALL, 'en_US.UTF-8') !== false) {
	localeConventions = localeconv();
	print_r($localeConventions);
}