PHP setlocale() İşlev
Örnek
Yerel ayarı ABD İngilizcesine ayarlayın ve ardından tekrar varsayılana dönün:
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
Tanım ve Kullanım
setlocale() işlevi yerel ayar bilgilerini ayarlar.
Yerel bilgi, bir coğrafi alana özgü dil, para, zaman ve diğer bilgilerdir.
Not: setlocale() işlevi, yalnızca geçerli komut dosyası için yerel ayarı değiştirir.
İpucu: Yerel ayar bilgileri, setlocale(LC_ALL,NULL) ile sistem varsayılanına ayarlanabilir
İpucu: Sayısal biçimlendirme bilgilerini almak için localeconv() işlevine bakın.
Sözdizimi
setlocale(constant,location)
Parametre Değerleri
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. |
Teknik detaylar
Geri dönüş değeri: | Geçerli yerel ayarları döndürür veya hata durumunda YANLIŞ. Dönüş değeri PHP'nin çalıştığı sisteme bağlıdır. |
---|---|
PHP Sürümü: | 4+ |
Değişiklik günlüğü: | PHP 5.3.0 - Sabit parametreye LC_ sabitlerinden biri yerine bir dize geçirilirse , bu işlev bir E_DREPRECATED uyarısı gönderir. |
❮ PHP Dize Referansı