PHP setlocale() function

Shirin

Tayin ƙirƙira US English, kuma kuma tayin ƙirƙira ƙananan alama ta ƙasa:

<?php
echo setlocale(LC_ALL, "US");
echo "<br>";
echo setlocale(LC_ALL, NULL);
?>

Shirin Ayyuka

Tattalin arziki da Yawon Shafin

Function setlocale() ta ƙirƙira ƙananan alama (ƙirƙira ƙananan alama).

Kwamfuriwansa yana ƙarɓaɗa ƙungiyar yankin ƙasa, harshe, kwallan, waɗanda suka ƙarɓaɗa da sauransu.

Comments:Function setlocale() ƙanana yana samar da ƙirƙira ƙananan alama wa script na yau.

Tushen:Dacewa setlocale(LC_ALL, NULL) domin ƙirƙira ƙananan alama ta ƙasa.

Tushen:Don samun ƙwararrun ƙirƙira, tsahe ka karɓi localeconv() Function.

Gwamna

setlocale(constant,location)
Parameters Bayani
constant

Dauki. Ta ce kuma ta ƙirƙira ƙananan alama da zai ƙarɓaɗa.

Kwamfuriwansa:

  • LC_ALL - Kuma na ƙa'idodin da suka cikin
  • LC_COLLATE - Ƙarantaccen
  • LC_CTYPE - Character Category and Conversion (e.g., all characters uppercase or lowercase)
  • LC_MESSAGES - System Message Format
  • LC_MONETARY - Currency Format
  • LC_NUMERIC - Number Format
  • LC_TIME - Date and Time Format
location

Required. Specifies which country/region the locale information should be set to. It can be a string or an array. Multiple locations can be passed.

If location If the parameter is NULL or an empty string "", the location name will be set to the value of the environment variable with the same name as the constant above or set according to "LANG".

If location If the parameter is "0", the location setting is not affected, and only the current setting is returned.

If location The parameter is an array, and setlocale() will try each array element until a valid language or locale code is found. This is very useful if a location has different names on different systems.

Comments:To view all available language codes, please visit ourLanguage Code Reference Manual.

Technical Details

Return Value: Returns the current locale settings, or FALSE if failed. The return value depends on the system running PHP.
PHP Version: 4+
Update Log:

In PHP 4.2.0, passing constants as strings is deprecated. Please use the available constants instead. Passing constants as strings will generate a warning message.

In PHP 4.3.0, multiple locations can be passed.

Starting from PHP 5.3.0, if passed to constant If the parameter is a string and not one of the LC_ constants, the function will throw an E_DREPRECATED notification.