Categories: PHP

localeconv() – PHP String Functions

Syntax :

localeconv ( )

Description :

It’s an inbuilt function of PHP. localeconv() function will Get numeric formatting information.


Output :

localeconv() returns data based upon the current locale as set by setlocale(). The associative array that is returned contains the following fields:

[table caption=”List of available flags constants are” max-width=”100%” colwidth=”25%|75%” colalign=”left|left”]

Array Element, Description
[decimal_point], Decimal point character
[thousands_sep],  Thousands separator
[int_curr_symbol], International currency symbol (i.e. USD)
[currency_symbol] ,  Local currency symbol (i.e. $)
[mon_decimal_point] , Monetary decimal point character
[mon_thousands_sep], Monetary thousands separator
[positive_sign], Handle code as HTML 5.
[positive_sign], Sign for positive values
[negative_sign], Sign for negative values
[int_frac_digits],International fractional digits
[frac_digits],Local fractional digits
[p_cs_precedes],TRUE if currency_symbol precedes a positive value FALSE if it succeeds one
[p_sep_by_space], TRUE if a space separates currency_symbol from a positive value otherwise FALSE
[n_cs_precedes] , TRUE if currency_symbol precedes a negative value FALSE if it succeeds one
[n_sep_by_space] , TRUE if a space separates currency_symbol from a negative value otherwise 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
[/table]


Related articles : stripos(), strpos(), strripos().


localeconv() – PHP Functions Example 1 :
<?php
setlocale(LC_ALL,"US");
$str_locale = localeconv();
print_r($str_locale);
?>

Output of above code in the browser is as below:

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
(
)

)


jyoti rani

Recent Posts

Modern Toys, Magical Moments: Why the Best Toy Shop in Noida Is More Than Just a Store

When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…

6 months ago

Rediscovering Joy: A New Era of Creativity & Comfort in Toy Stores

In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…

6 months ago

Unboxing Imagination: Discovering the Joy of Play at a Toy Store in Noida

In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…

6 months ago

Imagination Unboxed: Discover Joy at the Toy Shop in Delhi

In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…

6 months ago

Play with Purpose: Discovering the Ultimate Toy Store in Noida

When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…

6 months ago

From Tears to Toys: Exploring Modern Childhood through Delhi’s Favorite Toy Shop

In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…

6 months ago