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
广告