PHP setlocale() Funksie
Voorbeeld
Stel die plek in op Amerikaanse Engels en dan weer terug na verstek:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
Definisie en gebruik
Die setlocale() funksie stel locale inligting.
Plaaslike inligting is taal-, geld-, tyd- en ander inligting spesifiek vir 'n geografiese gebied.
Let wel: Die setlocale() funksie verander die locale slegs vir die huidige script.
Wenk: Die locale inligting kan gestel word op stelsel verstek met setlocale(LC_ALL,NULL)
Wenk: Sien die localeconv()- funksie om inligting oor numeriese formatering te kry .
Sintaksis
setlocale(constant,location)
Parameterwaardes
Parameter | Description |
---|---|
constant | Required. Specifies what locale information should be set. Available constants:
|
location | Required. Specifies what country/region to set the locale information to. Can be a string or an array. It is possible to pass multiple locations. 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. This is very useful if a region is known under different names on different systems. Note: To view all available language codes, go to our Language code reference. |
Tegniese besonderhede
Terugkeerwaarde: | Wys die huidige ligginginstellings, of ONWAAR as dit misluk. Die terugkeerwaarde hang af van die stelsel wat PHP gebruik. |
---|---|
PHP weergawe: | 4+ |
Veranderinglog: | PHP 5.3.0 - As 'n string na die konstante parameter gestuur word in plaas van een van die LC_ konstantes, gooi hierdie funksie 'n E_DREPRECATED kennisgewing. |
❮ PHP-stringverwysing