Example
ComparisonString:
"; setlocale (LC_COLLATE, 'en_US'); echo strcoll("Hello World!","Hello World!"); ?>
Definition and usage
strcoll() function compares two strings.
The comparison of strings changes depending on the local setting (Aa).
Note: strcoll() is case-sensitive, but not binarysafe.
Note: If the current locale is C or POSIX, this function works the same asstrcmp().
Syntax
strcoll(string1,string2)
Parameters | Description |
string1 | Required. Specifies the first string to compare. |
string2 | Required. Specifies the second string to be compared. |
Technical details
"; setlocale (LC_COLLATE, 'en_US'); echo strcoll("Hello World!","Hello WORLD!"); ?>
Output:
-1 1
The above is the detailed content of PHP function strcoll() that compares two strings (according to local settings). For more information, please follow other related articles on the PHP Chinese website!