nl_langinfo()
nl_langinfo() — Query language and locale information.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.1.0, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
nl_langinfo() is used to access individual elements of the locale categories. Unlike localeconv(), which returns all of the elements, nl_langinfo() allows you to select any specific element.
Signature
nl_langinfo(int $item): string|false
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $item | int | item may be an integer value of the element or the constant name of the element. The following is a list of constant names for item that may be used and their description. Some of these constants may not be defined or hold no value for certain locales. nl_langinfo Constants Constant Description LC_TIME Category Constants ABDAY_(1-7) Abbreviated name of n-th day of the week. DAY_(1-7) Name of the n-th day of the week ... |
Return value
Returns the element as a string, or false if item is not valid.
Example
A runnable snippet:
var_dump(nl_langinfo(CODESET)); var_dump(nl_langinfo(YESEXPR));
Output:
string(14) "ANSI_X3.4-1968" string(5) "^[yY]"
See also
All PHP 8.5 built-in functions
Reference card built from the PHP manual page nl_langinfo() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.