PHP Logical Operators
Operator | Name | Description | Example |
---|---|---|---|
x and y | And | True if both x and y are true | x=6 y=3 (x < 10 and y > 1) returns true |
x or y | Or | True if either or both x and y are true | x=6 y=3 (x==6 or y==5) returns true |
x xor y | Xor | True if either x or y is true, but not both | x=6 y=3 (x==6 xor y==3) returns false |
x && y | And | True if both x and y are true | x=6 y=3 (x < 10 && y > 1) returns true |
x || y | Or | True if either or both x and y are true | x=6 y=3 (x==5 || y==5) returns false |
! x | Not | True if x is not true | x=6 y=3 !(x==y) returns true |
No comments: