From the course: Learning PHP

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Logical operators

Logical operators - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Logical operators

- [Instructor] Now that you know how to compare numbers, there's another type of Boolean operator you should know about. Logical operators. Logical operators let us combine any number of Boolean statements to check the overall truthfulness of that statement. No matter how many statements you combine, you'll still result in one Boolean value, true or false. The first of these operators is the AND operator represented by two ampersands. And this proceeds as true as long as all parts of the statement are true. So for example, true AND true would evaluate to true. It would be like saying, "The sky is blue "and the sun is yellow." However, as soon as any of those statements evaluates to false, the entire statement evaluates to false. Again, that would be like saying, "The sky is blue and the grass is pink." Only half of that statement is true. So the entire statement evaluates to false. Then there's the OR operator…

Contents