strcoll
Comparison of strings based on locale settings
strcoll()
function compares two strings.
Comparison of strings varies according to local settings (A<a or A>a).
Note: strcoll()
is case sensitive, but not binary safe.
Note: If the current local setting is C or POSIX, the function works the same way as strcmp()
.
Compare strings:
<?php setlocale ( LC_COLLATE , 'NL' ) ; echo strcoll ( "Hello World!" , "Hello World!" ) ; echo "<br>" ; setlocale ( LC_COLLATE , 'en_US' ) ; echo strcoll ( "Hello World!" , "Hello World!" ) ; ?>
Try it yourself
strcoll ( string1 , string2 )
parameter | describe |
---|---|
string1 | Required. Specifies the first string to be compared. |
string2 | Required. Specifies the second string to be compared. |