Boolean logical operators include: "and" (logical AND), "or" (logical OR), "not" (logical NOT), "XOR" (logical exclusive OR). The logical AND explanation is equivalent to "AND", and only if two operands are true, the result will be true; the logical OR operator will return "false" when all operands are "false".
There are four types of Boolean logical operators: and (logical AND), or (logical OR), not (logical negation), XOR ( Logical XOR).
1. and (logical sum)
In life, logic and explanation are equivalent to "and". & calls a logical AND and the result is true only if both operands are true. & is called a concise AND or short-circuit, and if only two operands are true, the result is true.
2. or (logical OR)
If one or more operands are true, the logical OR operator returns the Boolean value true; only when all operands are false, the result It is false.
3. not (logical negation)
Logical negation is the reciprocal of the original value.
4. xor (logical exclusive OR)
If a and B are different, the exclusive or result is 1. If a and B are the same, exclusive or results in 0.
Extended information:
The origin of Boolean logical operators:
Boolean uses mathematical methods to study logical problems , successfully established a logical calculus. He used equality to represent judgment and regarded reasoning as the transformation of equality. The effectiveness of this transformation does not depend on people's interpretation of the symbols, but only on the combination rules of the symbols. This theory of logic is often called Boolean algebra.
In the 1930s, logic algebra was applied to circuit systems. Subsequently, with the development of electronic technology and computer technology, various complex large systems appeared, and their transformation laws also followed the laws revealed by Boolean operations.
For more related knowledge, please visit PHP Chinese website! !
The above is the detailed content of What are the Boolean logical operators?. For more information, please follow other related articles on the PHP Chinese website!