PHP setlocale() Functie
❮ Referentie voor PHP-tekenreeksen
Voorbeeld
Stel de landinstelling in op Amerikaans Engels en vervolgens weer terug naar de standaardinstelling:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
Definitie en gebruik
De functie setlocale() stelt de locale-informatie in.
Lokale informatie is taal, geld, tijd en andere informatie die specifiek is voor een geografisch gebied.
Opmerking: de functie setlocale() wijzigt de landinstelling alleen voor het huidige script.
Tip: De locale-informatie kan worden ingesteld op systeemstandaard met setlocale(LC_ALL,NULL)
Tip: Zie de functie localeconv() voor informatie over numerieke opmaak .
Syntaxis
setlocale(constant,location)
Parameterwaarden
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. |
Technische details
Winstwaarde: | Retourneert de huidige landinstellingen of FALSE bij een fout. De retourwaarde is afhankelijk van het systeem waarop PHP draait. |
---|---|
PHP-versie: | 4+ |
Wijzigingslogboek: | PHP 5.3.0 - Als een string wordt doorgegeven aan de constante parameter in plaats van een van de LC_-constanten, genereert deze functie een E_DREPRECATED-melding. |
❮ Referentie voor PHP-tekenreeksen