Using strcasecmp to compare two strings : strcasecmp « String « PHP






Using strcasecmp to compare two strings

 
<?php

$name1 = "Bill";
$name2 = "BILL";

$result = strcasecmp($name1, $name2);

if (!$result){
    echo "They match.";
}

?>
  
  








Related examples in the same category

1.Comparing strings case-insensitively
2.strcasecmp() function operates like strcmp(), except that its comparison is case insensitive.
3.int strcasecmp ( string str1, string str2 ) is a case-insensitive version of the strcmp( ) .