PHP setlocale() 함수
예시
로케일을 미국 영어로 설정한 다음 다시 기본값으로 설정합니다.
<?php
echo setlocale(LC_ALL,"US");
echo "<br>";
echo setlocale(LC_ALL,NULL);
?>
정의 및 사용
setlocale() 함수는 로케일 정보를 설정합니다.
로케일 정보는 언어, 통화, 시간 및 지리적 영역에 특정한 기타 정보입니다.
참고: setlocale() 함수는 현재 스크립트에 대해서만 로케일을 변경합니다.
팁: 로케일 정보는 setlocale(LC_ALL,NULL)을 사용하여 시스템 기본값으로 설정할 수 있습니다.
팁: 숫자 형식화 정보를 얻으려면 localeconv() 함수를 참조하십시오.
통사론
setlocale(constant,location)
매개변수 값
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. |
기술적 세부 사항
반환 값: | 현재 로케일 설정을 반환하거나 실패하면 FALSE를 반환합니다. 반환 값은 PHP가 실행 중인 시스템에 따라 다릅니다. |
---|---|
PHP 버전: | 4+ |
변경 로그: | PHP 5.3.0 - 문자열이 LC_ 상수 중 하나 대신 상수 매개변수에 전달되면 이 함수는 E_DREPRECATED 알림을 발생시킵니다. |
❮ PHP 문자열 참조