itlife365.com分享php一个简单的判断两个字符串是否相等的函数写法
<?php
//$str1,$str2 两个想比较的字符串
function strcomp($str1,$str2){
if($str1 == $str2){
return TRUE;
}else{
return FALSE;
}
}
//调用方法验证
echo strcomp("The First string","The Second string"); //Returns FALSE
echo strcomp("Astring","Astring"); //Returns TRUE
?>
<?php
//$str1,$str2 两个想比较的字符串
function strcomp($str1,$str2){
if($str1 == $str2){
return TRUE;
}else{
return FALSE;
}
}
//调用方法验证
echo strcomp("The First string","The Second string"); //Returns FALSE
echo strcomp("Astring","Astring"); //Returns TRUE
?>