Internationalization NumberFormatter::getLocale

NumberFormatter::getLocale

numfmt_get_locale

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL intl >= 1.0.0)

NumberFormatter::getLocale -- numfmt_get_locale — 포맷터 로케일 가져오기


설명

객체 지향 스타일 (method)

public NumberFormatter::getLocale(int $type = ULOC_ACTUAL_LOCALE): string|false

절차적 스타일

numfmt_get_locale(NumberFormatter $formatter, int $type = ULOC_ACTUAL_LOCALE): string|false

포맷터 로케일 이름을 가져옵니다.


매개변수

formatter
NumberFormatter object.
type
유효한 로케일과 실제 로케일(각각 Locale::VALID_LOCALE, Locale::ACTUAL_LOCALE) 중에서 선택할 수 있습니다. 기본값은 실제 로케일입니다.

반환 값

포맷터를 생성하는 데 사용되는 로케일 이름 또는 실패 시 false입니다.


Examples

예제 #1 numfmt_get_locale() 예제

                  
<?php
$req     = 'fr_FR_PARIS';
$fmt     = numfmt_create( $req,  NumberFormatter::DECIMAL);
$res_val = numfmt_get_locale( $fmt, Locale::VALID_LOCALE );
$res_act = numfmt_get_locale( $fmt, Locale::ACTUAL_LOCALE );
printf( "Requested locale name: %s\nValid locale name: %s\nActual locale name: %s\n",
         $req, $res_val, $res_act );
?>
                  
                

위의 예는 다음을 출력합니다.

Requested locale name: fr_FR_PARIS
Valid locale name: fr_FR
Actual locale name: fr
                

기타