(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getKeywordValuesForLocale — 取得地區設定關鍵字值集合
物件導向風格
$keyword, 字串 $locale, 布林值 $onlyCommon): IntlIterator|false程序式風格
針對給定的地區設定鍵,取得該鍵的值集合,這些值會導致不同的行為。目前僅支援 'calendar' 鍵。
此函式需要 ICU 4.2 或更高版本。
keyword要查詢相關值的語系設定關鍵字。僅支援 'calendar'。
locale要附加關鍵字/值對的語系設定。
onlyCommon是否僅顯示指定地區設定常用的值。
一個迭代器,產生帶有地區設定關鍵字值的字串,或在失敗時傳回 false。
範例 #1 IntlCalendar::getKeyworkValuesForLocale()
<?php
print_r(
iterator_to_array(
IntlCalendar::getKeywordValuesForLocale(
'calendar', 'fa_IR', true)));
print_r(
iterator_to_array(
IntlCalendar::getKeywordValuesForLocale(
'calendar', 'fa_IR', false)));上述範例將輸出
Array
(
[0] => persian
[1] => gregorian
[2] => islamic
[3] => islamic-civil
)
Array
(
[0] => persian
[1] => gregorian
[2] => islamic
[3] => islamic-civil
[4] => japanese
[5] => buddhist
[6] => roc
[7] => hebrew
[8] => chinese
[9] => indian
[10] => coptic
[11] => ethiopic
[12] => ethiopic-amete-alem
)