{site_name}

{site_name}

🌜 搜索

Collator::getStrength() is a method in P

php 𝄐 0
php从入门到精通,PHP compiled with module,PHP count函数,PHP conn->query (sql) 返回值是什么,PHP copy的无法访问 Windows,PHP 从零开始开发属于自己的
Collator::getStrength() is a method in PHP that is used to retrieve the current strength setting of a Collator object.

The strength setting determines the level of comparison used when sorting strings. It affects how strings with different characters or diacritical marks are treated.

The possible values for the strength setting are:

- Collator::PRIMARY (1): This is the lowest level of comparison. It only distinguishes between base characters, ignoring case differences and diacritical marks.

- Collator::SECONDARY (2): This level distinguishes between base characters and ignores case differences, but takes diacritical marks into account.

- Collator::TERTIARY (3): This level distinguishes between both case differences and diacritical marks.

- Collator::QUATERNARY (4): This level includes all the previous levels, but also takes punctuation differences into account.

- Collator::IDENTICAL (5): This level performs a binary comparison of the strings, taking into account the exact byte values of each character.

To use Collator::getStrength(), you would first need to create a Collator object using the Collator class and then call the getStrength() method on that object.

Here's an example:

php
$collator = new Collator('en_US');
$strength = $collator->getStrength();

echo "Current strength: $strength";


This example creates a Collator object with the 'en_US' locale and retrieves the current strength setting. The resulting strength value will be one of the constants mentioned before (1, 2, 3, 4, or 5).