int strcmp ( string str1, string str2 ), case-insensitive sibling, strcasecmp( )
<?
$string1 = "foo";
$string2 = "bar";
$result = strcmp($string1, $string2);
switch ($result) {
case -1: print "Foo comes before bar"; break;
case 0: print "Foo and bar are the same"; break;
case 1: print "Foo comes after bar"; break;
}
?>
Related examples in the same category