PHP if not equal(!=) and or (||) issue. Why doesnt this work?

前端 未结 6 1466
暗喜
暗喜 2021-01-06 10:22

I know this is simple PHP logic but it just won\'t work...

 $str = \"dan\";
 if(($str != \"joe\") 
   || ($str != \"danielle\")
   || ($str != \"heather\")
          


        
6条回答
  •  清歌不尽
    2021-01-06 10:28

    try this

    $str = "dan";
    
    if($str == "joe" || $str == "daniella" || $str == "heather" || $str == "laurine" || $str == "dan"){ ... }
    

提交回复
热议问题