strcasecmp 适用版本:php4 php5
strcasecmp — 二进制安全比较字符串(不区分大小写)
int strcasecmp ( string $str1 , string $str2 )
返回值:
//如果 str1 小于 str2,返回负数;如果 str1 大于 str2,返回正数;二者相等则返回 0。
简单示例:
<?php
$var1 = "Hello";
$var2 = "hello";
if (strcasecmp($var1, $var2) == 0) {
echo '$var1 is equal to $var2 in a case-insensitive string comparison';
}
?>
资料来源:PHP官方网
转载于:https://blog.51cto.com/windchaser/1303662