Funzione PHP setlocale()
❮ Riferimento alla stringa PHP
Esempio
Imposta le impostazioni internazionali sull'inglese americano e poi torna di nuovo alle impostazioni predefinite:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
Definizione e utilizzo
La funzione setlocale() imposta le informazioni sulla locale.
Le informazioni sulla località sono informazioni relative alla lingua, alla valuta, all'ora e ad altre informazioni specifiche per un'area geografica.
Nota: la funzione setlocale() cambia la locale solo per lo script corrente.
Suggerimento: le informazioni sulla localizzazione possono essere impostate sui valori predefiniti del sistema con setlocale(LC_ALL,NULL)
Suggerimento: per ottenere informazioni sulla formattazione numerica, vedere la funzione localeconv() .
Sintassi
setlocale(constant,location)
Valori dei parametri
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. |
Dettagli tecnici
Valore di ritorno: | Restituisce le impostazioni locali correnti o FALSE in caso di errore. Il valore restituito dipende dal sistema su cui è in esecuzione PHP. |
---|---|
Versione PHP: | 4+ |
Registro delle modifiche: | PHP 5.3.0 - Se una stringa viene passata al parametro constant invece di una delle costanti LC_, questa funzione genera un avviso E_DREPRECATED. |
❮ Riferimento alla stringa PHP