PHP strcoll() Function
Example
Compare strings:
"; setlocale (LC_COLLATE, 'en_US'); echo strcoll("Hello World!","Hello World!"); ?>Run Example »
Definition and Usage
The strcoll() function compares two strings.
The comparison of strings varies according to the locale setting (Aa).
**Note:** strcoll() is case-sensitive but not binary-safe.
**Note:** If the current locale setting is C or POSIX, this function works the same way as strcmp() .
Syntax
strcoll(
string1,string2
)
| Parameters | Description |
|---|---|
| string1 | Required. Specifies the first string to compare. |
| string2 | Required. Specifies the second string to compare. |
Technical Details
| Return value: | This function returns:
- 0 - If the two strings are equal
- <0 - If string1 is less than string2
- >0 - If string1 is greater than string2
PHP String Reference Manual