PHP为什么此&&不会触发为false?
这是因为如果使用&&,则两个条件都必须为真。如果任何一个条件为假,则整体条件为假。
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
热门推荐
10 旅行前祝福语简短英语
11 结婚祝福语亲姐姐简短
12 毕业贺卡老师祝福语简短
13 甄嬛传祝福语简短
14 新婚祝福语大全简短经典
15 上班祝福语简短文案
16 干老师祝福语朋友简短
17 邮政考试祝福语简短励志
18 给女老板简短祝福语