Compare string : String Compare « String « PHP






Compare string


<?
$string_1 = "00008";
$string_2 = "007";
$string_3 = "00008-OK";

if ($string_2 < $string_1){
  print("$string_2 is less than $string_1<BR>");
}

if ($string_3 < $string_2){
  print("$string_3 is less than $string_2<BR>");
}
if ($string_1 < $string_3){
  print("$string_1 is less than $string_3<BR>");
}
?>
           
       








Related examples in the same category

1.String compare demo: =
2.String compare: equal
3.strcasecmp: Binary safe case-insensitive string comparison
4.String compare with if statement