From the course: PHP for Non-Programmers

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Combining comparisons

Combining comparisons - PHP Tutorial

From the course: PHP for Non-Programmers

Combining comparisons

- [Instructor] Comparisons, or Boolean operators, or Boolean statements are one side of the coin. The other side of the coin is something called logical operators. Perhaps you remember the concept of truth tables from a math class. It's the idea that if you combine two statements, you can evaluate how true the overall statement is. If I say I am 36 years old and I'm nine feet tall, this overall statement is untrue because both sides of the statement are not true. Conversely, if I say I'm 36 years old or I'm nine feet tall, this is true. The or allows us to accept the entire statement is true if at least one part of it is true. That's exactly what logical operators do for us in code. Logical operators allow us to combine any number of Boolean statements and check the overall truthfulness of the statement. No matter how many Boolean statements you combine, the result will still be one Boolean value, true or false. So let's…

Contents