PHP Conference Japan 2024

Collator::create

collator_create

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

Collator::create -- collator_create建立排序器

說明

物件導向風格

public static Collator::create(string $locale): ?Collator

程序式風格

collator_create(字串 $locale): ?Collator

字串將根據已指定的選項進行比較。

參數

locale

包含所需排序規則的語系設定。可以傳入特殊的語系設定值 - 如果傳入空 字串 作為語系設定,則將使用預設的語系設定排序規則。如果傳入 "root",則將使用 » UCA 規則。

回傳值

回傳 Collator 物件的新實例,或錯誤時回傳 null

範例

範例 #1 collator_create() 範例

<?php
$coll
= collator_create( 'en_US' );

if( !isset(
$coll ) ) {
printf( "建立 Collator 失敗:%s\n", intl_get_error_message() );
exit(
1 );
}
?>

另請參閱

新增註解

使用者提供的註解

此頁面沒有使用者提供的註解。
To Top