PHP -zelfstudie

PHP HOME PHP-intro PHP-installatie PHP-syntaxis PHP-opmerkingen PHP-variabelen PHP-echo / afdrukken PHP-gegevenstypen PHP-strings PHP-nummers PHP-wiskunde PHP-constanten PHP-operators PHP Als...Anders...Anders PHP-switch PHP-loops PHP-functies PHP-arrays PHP Superglobals PHP RegEx

PHP- formulieren

PHP-formulierverwerking PHP-formuliervalidatie PHP-formulier vereist URL/e-mail van PHP-formulier PHP-formulier voltooid

PHP Geavanceerd

PHP-datum en tijd PHP opnemen PHP-bestandsverwerking PHP-bestand openen/lezen PHP-bestand maken/schrijven PHP-bestand uploaden PHP-cookies PHP-sessies PHP-filters PHP-filters geavanceerd PHP-callback-functies PHP JSON PHP-uitzonderingen

PHP OOP

PHP Wat is OOP PHP-klassen/objecten PHP-constructor PHP-vernietiger PHP-toegangsmodificaties PHP-overerving PHP-constanten PHP abstracte lessen PHP-interfaces PHP-kenmerken PHP statische methoden Statische eigenschappen van PHP PHP-naamruimten PHP-iterables

MySQL- database

MySQL-database MySQL Connect MySQL DB maken MySQL-tabel maken MySQL Gegevens invoegen MySQL Laatste ID ophalen MySQL Meerdere invoegen MySQL voorbereid MySQL Gegevens selecteren MySQL Waar MySQL Bestel op MySQL Gegevens verwijderen MySQL-updategegevens MySQL-limietgegevens

PHP XML

PHP XML-parsers PHP SimpleXML-parser PHP SimpleXML - Get PHP XML Expat PHP XML DOM

PHP - AJAX

Ajax-intro AJAX PHP AJAX-database AJAX XML Live zoeken in Ajax Ajax-peiling

PHP- voorbeelden

PHP-voorbeelden PHP-compiler PHP-quiz PHP-oefeningen PHP-certificaat

PHP- referentie

PHP-overzicht PHP-array PHP-agenda PHP-datum PHP-map PHP-fout PHP-uitzondering PHP-bestandssysteem PHP-filter PHP FTP PHP JSON PHP-sleutelwoorden PHP Libxml PHP-e-mail PHP-wiskunde PHP Diversen PHP MySQLi PHP-netwerk PHP-uitvoercontrole PHP RegEx PHP SimpleXML PHP-stream PHP-string Beheer van PHP-variabelen PHP XML-parser PHP-zip PHP-tijdzones

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:

  • 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.

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