Collator::compare
collator_compare
Compare two Unicode strings
&reftitle.description;
&style.oop;
int
Collator::compare
stringstr1
stringstr2
&style.procedural;
int
collator_compare
Collatorcoll
stringstr1
stringstr2
Compare two Unicode strings according to collation rules.
&reftitle.parameters;
coll
Collator object.
str1
The first string to compare.
str2
The second string to compare.
&reftitle.returnvalues;
Return comparison result:
1 if str1 is greater than
str2 ;
0 if str1 is equal to
str2;
-1 if str1 is less than
str2 .
On error
boolean
&false;
is returned.
&return.falseproblem;
&reftitle.examples;
collator_compareexample
0 ) {
echo "s1 is greater than s2\n";
} else if( $res < 0 ) {
echo "s1 is less than s2\n";
} else {
echo "s1 is equal to s2\n";
}
?>
]]>
&example.outputs;
s1 is greater than s2
&reftitle.seealso;
collator_sort