PHP strcoll() Function
The strcoll()
function is used to compare two strings. The comparison of strings based locale settings.
Syntax
strcoll(string1,string2)
- string1 - (required) Specify the first string to compare.
- string2 - (required) Specify the second string to compare.
- Return value
0 - Two Strings are equal.
<0 - if string1 is lesser than string2
>0 - if string1 is greater than string2
Example
<?php setlocale (LC_COLLATE, 'NL'); echo strcoll("Good Morning!","Good Morning!"); echo "<br>"; setlocale (LC_COLLATE, 'en_US'); echo strcoll("Good Morning!","Good Morning!"); ?>
Output
0 0