Esercitazione PHP

PHP HOME Introduzione a PHP Installazione PHP Sintassi PHP Commenti PHP Variabili PHP PHP Eco/Stampa Tipi di dati PHP Stringhe PHP Numeri PHP PHP matematica Costanti PHP Operatori PHP PHP Se...Altro...Altro Passaggio PHP Ciclo PHP Funzioni PHP Matrici PHP Superglobali PHP RegEx PHP

Moduli PHP

Gestione dei moduli PHP Convalida del modulo PHP Modulo PHP richiesto URL/e-mail del modulo PHP Modulo PHP completo

PHP avanzato

Data e ora PHP PHP Include Gestione dei file PHP Apri/Leggi file PHP Creazione/scrittura di file PHP Caricamento file PHP Cookie PHP Sessioni PHP Filtri PHP Filtri PHP avanzati Funzioni di callback PHP PHP JSON Eccezioni PHP

PHP OOP

PHP Che cos'è OOP Classi/Oggetti PHP Costruttore PHP PHP distruttore Modificatori di accesso PHP Ereditarietà PHP Costanti PHP Classi astratte PHP Interfacce PHP Tratti PHP Metodi statici PHP Proprietà statiche PHP Spazi dei nomi PHP Iterabili PHP

Database MySQL

Database MySQL MySQL Connect MySQL Crea DB MySQL Crea tabella Dati di inserimento MySQL MySQL Ottieni l'ultimo ID MySQL inserisce più MySQL preparato MySQL Seleziona dati MySQL dove MySQL Ordina per MySQL Elimina dati Dati di aggiornamento MySQL Dati limite MySQL

PHP XML

Parser XML PHP Analizzatore PHP SimpleXML PHP SimpleXML - Ottieni PHP XML espatriato PHP XML DOM

PHP - AJAX

Introduzione all'Ajax AJAX PHP Database AJAX XML AJAX Ricerca in tempo reale AJAX Sondaggio AJAX

Esempi PHP

Esempi PHP compilatore PHP Quiz PHP Esercizi PHP Certificato PHP

Riferimento PHP

Panoramica di PHP matrice PHP Calendario PHP Data PHP Directory PHP Errore PHP Eccezione PHP File system PHP Filtro PHP PHP FTP PHP JSON Parole chiave PHP PHP Libxml Posta PHP PHP matematica PHP Varie PHP MySQLi Rete PHP Controllo dell'output PHP RegEx PHP PHP SimpleXML Flusso PHP Stringa PHP Gestione delle variabili PHP Analizzatore XML PHP Zip PHP Fuso orario PHP

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:

  • LC_ALL - All of the below
  • LC_COLLATE -  Sort order
  • LC_CTYPE - Character classification and conversion (e.g. all characters should be lower or upper-case)
  • LC_MESSAGES - System message formatting
  • LC_MONETARY - Monetary/currency formatting
  • LC_NUMERIC - Numeric formatting
  • LC_TIME - Date and time formatting
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