(PHP 5 >= 5.5.0, PHP 7, PHP 8, PECL >= 3.0.0a1)
IntlCalendar::getKeywordValuesForLocale — 获取区域设置关键字值集
面向对象风格
$keyword, string $locale, bool $onlyCommon): IntlIterator|false过程化风格
$keyword, string $locale, bool $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
)