這條if語句觸發條件中的值,不管條件中的值如何,無論條件是否成立,條件爲什麼會觸發執行。我試過了每一個場景,但是每次都會觸發語句中的執行。如果語句條件觸發,無論條件是否滿足
if(1 != 1 && 1 != 2){
execute code
exit();
}
這裏是確切的代碼:
if($name1 != $winner && $name2 != $winner){
echo " The player you chose as winner is not associated with match id: $match_id ";
exit();
}
不,這不是真的 - http://sandbox.onlinephpfunctions.com/code/a227c5ddd20c3e331bbed7a1c042438a3d4fc880 – user2655603
正確的說法是不正確的,但在我的情況下它執行的代碼 – user5420896
無論條件爲真,或者相同的代碼也存在於其他地方。 (禁止瘋狂的東西,像跳轉到塊的goto。)你真的試圖用''''if(false)'''替換條件嗎? – blues