The setlocale() function sets locale information for the current script.
Locale information is the information specific for a geographical area, for example the money letter, the language.
The locale information can be set to system default with setlocale(LC_ALL,NULL)
PHP setlocale() Function has the following syntax.
|constant||Required.||What locale information should be set.|
|location||Required.||What country/region to set the locale information to. Can be a string or an array to pass multiple locations.|
Available value for constant:
If the location is NULL or the empty string "", the location names will be set from the values of environment variables with the same names as the constants above, or from "LANG".
If the location is "0", the location setting is not affected, only the current setting is returned.
If the location is an array, setlocale() will try each array element until it finds a valid language or region code.
PHP setlocale() Function returns the current locale settings, or FALSE on failure.
Set the locale to US English and then back to default again:
<?php echo setlocale(LC_ALL,"US"); echo "\n"; echo setlocale(LC_ALL,NULL); ?>
The code above generates the following result.