Collator::__construct() - Collator类
Collator::__construct()
(PHP 5 >= 5.3.0, PHP 7, PECL intl >= 1.0.0)
Create a collator
说明
publicCollator::__construct(string $locale)Creates a new instance of Collator.
参数
$localeThe locale whose collation rules should be used. Special values for locales can be passed in - if null is passed for the locale, the default locale's collation rules will be used. If "root" is passed, UCA rules will be used.
The Locale attribute is typically the most important attribute for correct sorting and matching, according to the user expectations in different countries and regions. The default » UCA ordering will only sort a few languages such as Dutch and Portuguese correctly("correctly" meaning according to the normal expectations for users of the languages). Otherwise, you need to supply the locale to UCA in order to properly collate text for a given language. Thus a locale needs to be supplied so as to choose a collator that is correctly tailored for that locale. The choice of a locale will automatically preset the values for all of the attributes to something that is reasonable for that locale. Thus most of the time the other attributes do not need to be explicitly set. In some cases, the choice of locale will make a difference in string comparison performance and/or sort key length.
返回值
Returns Collator instance.
错误/异常
Returns an "empty" object on error. You can use intl_get_error_code() and/or intl_get_error_message() to know what happened.
范例
Collator::__construct() example
参见
- Collator::create() Create a collator
- collator_create() Create a collator
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!