Home >>PHP Tutorial >PHP localeconv() Function

# PHP localeconv() Function

### PHP localeconv() Function

PHP localeconv() function is used to get United States locale numeric formatting information. This function is a non-parameterized function, which means this function does not need any value to be pass as input. This function returns an array as result which contains local numeric and monetary formatting information.

Syntax:

` localeconv();  `

### Value returned by localeconv():

Array Elements Description
decimal_point Represents decimal point character.
thousand_sep Represents thousands separator.
int_curr_symbol International Currency Symbol (USD).
currency_symbol Local currency symbol (\$).
mon_decimal_point Represents Monetary decimal point character.
mon_thousands_sep Represents Monetary thousands separator.
positive_sign Positive value sign.
negative_sign Negative value sign.
int_frac_digits Represents International fractional digits.
Represent Local fractional digits.

Here is an example of localeconv() function in PHP:

```<html>
<body>

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

</body>
</html>
```
Output:
Array
(
[decimal_point] => .
[thousands_sep] =>
[int_curr_symbol] => USD
[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] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 3
[n_sign_posn] => 0
[grouping] => Array
(
)
[mon_grouping] => Array
(
 => 3
)
)

Here is an another example of localeconv() function in PHP:

```<html>
<body>

<?php
setlocale(LC_MONETARY,"US");
\$localeinfo =localeconv();
print_r(\$localeinfo);
?>

</body>
</html>
```
Output:
Array
(
[decimal_point] => .
[thousands_sep] => ,
[int_curr_symbol] => USD
[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] => 0
[n_cs_precedes] => 1
[n_sep_by_space] => 0
[p_sign_posn] => 3
[n_sign_posn] => 0
[grouping] => Array
(
 => 3
)
[mon_grouping] => Array
(
 => 3
)
)
{"ft_lang_label":"__label__en","ft_lang_prob":0.5548917,"math_prob":0.99009055,"size":1248,"snap":"2019-51-2020-05","text_gpt3_token_len":270,"char_repetition_ratio":0.1511254,"word_repetition_ratio":0.07042254,"special_character_ratio":0.2235577,"punctuation_ratio":0.16759777,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9816803,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-01-20T12:39:22Z\",\"WARC-Record-ID\":\"<urn:uuid:769f97bd-8232-481f-a3d1-04a806c128cd>\",\"Content-Length\":\"38065\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:245ca8f9-d305-4bd7-b05a-701d6ab31f85>\",\"WARC-Concurrent-To\":\"<urn:uuid:9223ce1b-9d34-444c-8ef3-e2576e296895>\",\"WARC-IP-Address\":\"103.211.217.36\",\"WARC-Target-URI\":\"https://www.phptpoint.com/php-string-localeconv-function/\",\"WARC-Payload-Digest\":\"sha1:GPYSH2QT5I5SND56Y4WVYNHXK33SPCPN\",\"WARC-Block-Digest\":\"sha1:3VEUSISOIS4EEEQ7MOJEBFTEM5AH7CU6\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-05/CC-MAIN-2020-05_segments_1579250598726.39_warc_CC-MAIN-20200120110422-20200120134422-00256.warc.gz\"}"}