What is the logical operation of this condition 1AND (0OR condition 2? We encountered such a problem recently. for details about logical operations, see Condition 1 & nbsp; AND & nbsp; (& nbsp; 0 & nbsp; OR & nbsp; condition 2) if there is no keyword, the following part is (0) condition 1 & nbsp; AND & nbsp; (& nbsp; 0), that is, it is not true, what is the logical operation of condition 1 AND (0 OR condition 2?
Recently, we encountered such a problem about logical operations. please refer:
Condition 1 AND (0 OR condition 2)
If no keyword exists, the following part is (0)
Condition 1 AND (0) is not true. no query results are returned, AND no keywords are entered.
If yes, then:
Condition 1 AND (0 OR condition 2)
Actually
Condition 1 AND (condition 2)
I wrote a test code:
$ A = 3;
$ B = 0;
If ($ a and (1 OR $ B ))
{
Print $ a. $ B;
}
Else
{
Print "false ";
}
?>
I intentionally wrote the and (0 OR $ B) above as and (1 OR $ B). the test results are as follows:
30
Some netizens pointed out that and (1 and $ B) OR and (0 OR $ B). when the condition is "AND", add 1 to the front, if the condition is OR, adding 0 does not affect the result set.
But I intentionally wrote the opposite, and got the test result 30. I still don't know the expression, and I don't know where the idea is. of course, if it is written in $ a and (0 OR $ B), false will be output, because only one side of the value is true, but I still don't know where the difference is. can you give me some advice? Thank you.
------ Solution --------------------
1and $ B requires both conditions to be true.
1or $ B because we have determined that the previous one is true, the latter is not true.
0 or $ B is not true before o, so continue to judge whether $ B is true.