strcoll()
strcoll() — Locale based string comparison.
Built-in function of PHP 8.5. The manual lists it as available in PHP 4 >= 4.0.5, PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.
What it does
Note that this comparison is case sensitive, and unlike strcmp() this function is not binary safe.
Signature
strcoll(string $string1, string $string2): int
Parameters
| Parameter | Type | What it takes |
|---|---|---|
| $string1 | string | The first string. |
| $string2 | string | The second string. |
Return value
Returns < 0 if string1 is less than string2; > 0 if string1 is greater than string2, and 0 if they are equal.
Example
The PHP manual ships no example for strcoll(); the signature and the parameter table above are the contract.
See also
preg_match(), strcmp(), strcasecmp(), substr(), stristr(), strncasecmp(), strncmp(), strstr(), setlocale()
All PHP 8.5 built-in functions
Reference card built from the PHP manual page strcoll() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.