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
廣告
資料結構
網路
RDBMS
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP