nl_langinfo


multil apg

RETRIEVES the LOCALE language information.

This function is usually preceded by  setlocale .

This function is not implemented on Windows™ platforms



<?php


string
|false nl_langinfo int $item )

where,

$item VALUE or CONSTANT NAME of the element
                 to retrieve information

?>
 

$item


The VALUE or CONSTANT NAME of the element to retrieve information.

This function returns data based upon the current LOCALE as set by  setlocale .

Some of these constants may not be defined or hold no value for certain LOCALEs.

The following table, list the constant names for to see the variable to be used:


<?php

// FIRST STRUCTURE

string|false setlocale int $category
                              
string $locales,  
                           
string ...$rest  )


where,

$category CONSTANT  to specify the 
                    category of the functions affected by the locale setting

$locales 
STRING to configure how the value is returned by the environment

$rest 
The optional locale names as STRINGS

?>

<?php

// SECOND STRUCTURE

string|false setlocale int $category, array $locale_array )

where,

int $category named constant specifying the 
                        category of the functions affected
                        by the locale setting

$locale_array 
=> each array element must be used as settings for locale.

?>

CONSTANTS
RELATIONSHIP

TYPE
VALUES

RETURNS
CATEGORY
CODESET

INTEGER
14

Category Constants

LC_CTYPE
LC_TIME - Category Constants
ABDAY_[1, 7]

INTEGER
[131072, 131078]

Abbreviated name of
n-th day of the week


LC_TIME
DAY_[1, 7]

INTEGER
[131079, 131085]

Name of the n-th day of the week

ABMON_[1, 12]

INTEGER
[131086, 131097]

Abbreviated name of
the n-th month of the year


MON_[1, 12]

INTEGER
[131098, 131109]

Name of
the n-th month of the year


AM_STR

INTEGER
131110

STRING for Ante meridian

PM_STR

INTEGER
131111

STRING for Post meridian

D_T_FMT

INTEGER
131112

STRING that can be used as the format STRING for strftime to represent time and date

D_FMT

INTEGER
131113

STRING that can be used as the format STRING for strftime to represent date

T_FMT

INTEGER
131114

STRING that can be used as the format STRING for strftime to represent time

T_FMT_AMPM

INTEGER
131115

STRING that can be used as the format STRING for strftime to represent time in 12-hour format with ante/post meridian.

LC_TIME - Category Constants
ERA

INTEGER
131116

Alternate ERA

LC_TIME
ERA_YEAR

INTEGER
ERA_YEAR

YEAR in alternate ERA format

ERA_D_FMT

INTEGER
131118

DATE in
alternate ERA format
STRING can be used in strftime


ERA_D_T_FMT

INTEGER
131120

ATE and TIME in
the alternate ERA format
STRING can be used in strftime


ERA_T_FMT

INTEGER
131121

TIME in alternate era format
STRING can be used in strftme


LC_MONETARY - Category Constants
INT_CURR_SYMBOL

INTEGER
INT_CURR_SYMBOL

Monetary symbol, according to LOCALE

LC_MONETARY
CURRENCY_SYMBOL

INTEGER
CURRENCY_SYMBOL

International currency symbol

CRNCYSTR

INTEGER
262159

Same value as CURRENCY_SYMBOL

MON_DECIMAL_POINT

INTEGER
MON_DECIMAL_POINT

Decimal point character

MON_THOUSANDS_SEP

INTEGER
MON_THOUSANDS_SEP

Thousands separator

MON_GROUPING

INTEGER
MON_GROUPING

Like GROUPING element

POSITIVE_SIGN

INTEGER
POSITIVE_SIGN

Sign for positive values

NEGATIVE_SIGN

INTEGER
NEGATIVE_SIGN

Sign for negative values

INT_FRAC_DIGITS

INTEGER
INT_FRAC_DIGITS

International fractional digits

FRAC_DIGITS

INTEGER
FRAC_DIGITS

Local fractional digits

P_CS_PRECEDES

INTEGER
P_CS_PRECEDES

Returns 1
if CURRENCY_SYMBOL precedes a positive value


P_SEP_BY_SPACE

INTEGER
P_SEP_BY_SPACE

Returns 1
if a space separates CURRENCY_SYMBOL from a positive value


N_CS_PRECEDES

INTEGER
N_CS_PRECEDES

Returns 1
if CURRENCY_SYMBOL precedes a negative value


N_SEP_BY_SPACE

INTEGER
N_SEP_BY_SPACE

Returns 1
if a space separates CURRENCY_SYMBOL from a negative value


P_SIGN_POSN

INTEGER
P_SIGN_POSN

Returns 0
if parentheses surround the quantity and CURRENCY_SYMBOL

Returns 1
if the sign STRING precedes the quantity and CURRENCY_SYMBOL

Returns 2
if the sign STRING follows the quantity and CURRENCY_SYMBOL

Returns 3
if the sign STRING immediately precedes the CURRENCY_SYMBOL

Returns 4
if the sign STRING immediately follows the CURRENCY_SYMBOL


N_SIGN_POSN

INTEGER
N_SIGN_POSN

Returns 0
if parentheses surround the quantity and CURRENCY_SYMBOL

Returns 1 if the sign STRING precedes the quantity and CURRENCY_SYMBOL

Returns 2
if the sign STRING follows the quantity and CURRENCY_SYMBOL

Returns 3
if the sign STRING immediately precedes the CURRENCY_SYMBOL

Returns 4
if the sign STRING immediately follows the CURRENCY_SYMBOL


LC_NUMERIC - Category Constants
DECIMAL_POINT

INTEGER
DECIMAL_POINT

Decimal point character

LC_NUMERIC
RADIXCHAR

INTEGER
65536

Same value as DECIMAL_POINT

THOUSANDS_SEP

INTEGER
THOUSANDS_SEP

Separator character for thousands

THOUSEP

INTEGER
65537

Same value as THOUSANDS_SEP

GROUPING

INTEGER
GROUPING
LC_MESSAGES - Category Constants
YESEXPR

INTEGER
327680

Regex STRING
for matching "yes" input


LC_MESSAGES
NOEXPR

INTEGER
327681

Regex STRING
for matching "no" input


YESSTR

INTEGER
YESSTR

Output STRING for "yes"

NOSTR

INTEGER
NOSTR

Output STRING for "no"

ed48

  1 EXERCISE   

<?php

$lang 
'en';

setlocale(LC_ALL"en_US");

if (
function_exists('nl_langinfo'))
{
echo 
'setlocale(LC_ALL, "en_US")<br><br><br>';

for (
$cd1 131072$cd1 <= 131078$cd1++)
{
echo 
nl_langinfo($cd1) . '&nbsp;&nbsp;';
}
}
else
{
$en 'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
echo $
$lang;
}

?> 

 RESULT   

setlocale(LC_ALL, "en_US")

Sun Mon Tue Wed Thu Fri Sat


This function is not implemented on Windows™ platforms.


  2 EXERCISE   

<?php

$lang 
'en';

setlocale(LC_ALL"en_US");

if (
function_exists('nl_langinfo'))
{
echo 
'setlocale(LC_ALL, "en_US")<br><br><br>';

echo 
nl_langinfo(CODESET) . '<br><br>';
}
else
{
$en 'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
echo $
$lang;
}

?> 

 RESULT   

setlocale(LC_ALL, "en_US")

ISO-8859-1


This function is not implemented on Windows™ platforms.


  3 EXERCISE   

<?php

$lang 
'en';

if (
function_exists('nl_langinfo'))
{
setlocale(LC_ALL"pt_BR");
$codesetd nl_langinfo(CODESET);
$monesd nl_langinfo(CRNCYSTR);

echo 
'<br>CODESET D = ' $codesetd 
            
'&nbsp;&nbsp;CURRENCY_SYMBOL = ' $monesd;

setlocale(LC_ALL"pt_BR.utf-8");
$codesetn nl_langinfo(CODESET);
$monesn nl_langinfo(CRNCYSTR);

echo 
'<br><br><br>CODESET N = ' $codesetn 
               
'&nbsp;&nbsp;CURRENCY_SYMBOL = ' $monesn ;
}
else
{
$en 'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
echo 
'<br>' . $$lang '<br><br>';
}

?> 

 RESULT   

CODESET D = ISO-8859-1 CURRENCY_SYMBOL = -R$

CODESET N = UTF-8 CURRENCY_SYMBOL = -R$


This function is not implemented on Windows™ platforms.


  4 EXERCISE   

<?php

$lang 
'pt';

setlocale(LC_ALL"pt_PT.utf-8""pt-PT");

if (
function_exists('nl_langinfo'))
{
echo 
'setlocale(LC_ALL, "pt_PT.utf-8")<br><br><br>';

for (
$cd4 131079$cd4 <= 131085$cd4++)
{
echo 
nl_langinfo($cd4) . '<br>';
}
}
else
{
$en 'FUNCTION NOT IMPLEMENTED ON THIS PLATFORM!';
$pt 'FUNÇÃO NÃO DEFINIDA PARA ESTE AMBIENTE!';
echo 
'<br>' . $$lang '<br><br>';
}

?>

 RESULT   

setlocale(LC_ALL, "pt_PT.utf-8", "pt-PT")

Domingo
Segunda
Terça
Quarta
Quinta
Sexta
Sábado


This function is not implemented on Windows™ platforms.