Set the region to US English, and then set it back to the system default:
<?phpecho setlocale(LC_ALL,"US");echo "<br>";echo setlocale(LC_ALL,NULL);?>The setlocale() function sets regional information (regional information).
Regional information is language, currency, time, and other information for a geographic area.
Note: The setlocale() function only changes locale information for the current script.
Tip: You can set the region information as the system default through setlocale(LC_ALL,NULL).
Tip: For number format information, check out the localeconv() function.
setlocale( constant,location )
parameter | describe |
---|---|
constant | Required. Specifies what region information should be set. Available constants: LC_ALL - includes all options below LC_COLLATE - sort order LC_CTYPE - Character types and conversions (e.g. all characters uppercase or lowercase) LC_MESSAGES - System message format LC_MONETARY - currency format LC_NUMERIC - Number format LC_TIME - date and time format |
location | Required. Specifies the country/region to which the regional information is set. Can be a string or array. Multiple locations can be passed. If the location parameter is NULL or the empty string "", the location name will be set to the value of the environment variable with the same name in the constant above or set according to "LANG". If the location parameter is "0", the location settings are not affected and only the current settings are returned. If the location parameter is an array, setlocale() tries each array element until a valid language or region code is found. This is useful if a region has different names on different systems. Note: To view all available language codes, visit our Language Codes Reference Manual. |
Return value: | Returns the current locale, or FALSE on failure. The return value depends on the system on which PHP is running. |
---|---|
PHP version: | 4+ |
Update log: | Passing constants as strings has been deprecated in PHP 4.2.0. Please use available constants instead. Passing a constant as a string produces a warning message. In PHP 4.3.0, multiple locations can be passed. As of PHP 5.3.0, if a string is passed to the constant parameter instead of one of the LC_ constants, this function throws an E_DREPRECATED notification. |