这是因为如果使用&&,则两个条件都必须为真。如果任何一个条件为假,则整体条件为假。
PHP代码如下-
<!DOCTYPE html>
<html>
<body>
<?php
   $firstCondition= "John";
   $secondCondition = "David";
   if ($firstCondition == "John" && $secondCondition == "David" && ($firstCondition == "Mike" || $firstCondition == "John")) {
      echo "The above condition is true";
   } else {
      echo "The above condition is not true";
   }
?>
</body>
</html>输出结果
The above condition is true