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官方網