PHP逻辑操作符

Logical Operators
ExampleNameResult
$a and $b And TRUE if both $a and $b are TRUE.
$a or $b Or TRUE if either $a or $b is TRUE.
$a xor $b Xor TRUE if either $a or $b is TRUE, but not both.
! $a Not TRUE if $a is not TRUE.
$a && $b And TRUE if both $a and $b are TRUE.
$a || $b Or TRUE if either $a or $b is TRUE.

这个不用多少什么了。大家都清楚的很。

and 和&& 等价;

or 和|| 等价;

还有个就是那个不常用的逻辑操作符"xor"。有些逻辑使用这个操作符可以省很多。。

原文地址:https://www.cnblogs.com/ainiaa/p/1786645.html