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
- [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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Boolean operators and the truth (update for PHP 8.0)6m 27s
-
(Locked)
Logical operators6m 34s
-
(Locked)
Creating if/else statements8m 5s
-
(Locked)
Ternary operations5m 53s
-
(Locked)
Switch statements7m 8s
-
(Locked)
Match expression8m 4s
-
(Locked)
Challenge: Display content based on status1m
-
(Locked)
Solution: Display content based on status5m 1s
-
-
-
-
-
-
-
-
-