Internationalization Functions Examples

각 모듈은 절차적 API와 객체 지향 API의 두 가지 종류의 API를 제공합니다. 둘 다 실제로 동일하며 해당 문서에 설명되어 있습니다.

메모: 모든 입력 문자열은 UTF-8 인코딩이어야 합니다. 모든 출력 문자열도 UTF-8입니다.

예제 #1 절차적 API 사용 예

                  
<?php
$coll  = collator_create('en_US');
$result = collator_compare($coll, "string#1", "string#2");
?>
                  
                

예제 #2 객체 지향 API 사용 예제

                  
<?php
$coll = new Collator('en_US');
$al   = $coll->getLocale(Locale::ACTUAL_LOCALE);
echo "Actual locale: $al\n";

$formatter = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
echo $formatter->format(1234567);
?>