PHP/String/strcasecmp
Содержание
Comparing strings case-insensitively
<source lang="html4strict">
<? if (strcasecmp("a@demo.ru", "a@demo.ru") == 0) {
print "Welcome back, Mr..";
} ?>
</source>
int strcasecmp ( string str1, string str2 ) is a case-insensitive version of the strcmp( ) .
<source lang="html4strict">
<?
$result = strcasecmp("Hello", "hello");
?>
</source>
strcasecmp() function operates like strcmp(), except that its comparison is case insensitive.
<source lang="html4strict">
Its syntax is: int strcasecmp (string string1, string string2) <? $string1 = "butter"; $string2 = "Butter"; if ((strcasecmp($string1, $string2)) == 0) :
print "Strings are equivalent!";
endif; ?>
</source>
Using strcasecmp to compare two strings
<source lang="html4strict">
<?php $name1 = "Bill"; $name2 = "BILL"; $result = strcasecmp($name1, $name2); if (!$result){
echo "They match.";
} ?>
</source>