Learn
Logical Operators and Compound Conditions
Review

Great job! You’ve learned the tools needed to craft programs with powerful decision making capabilities. Let’s review what we covered:

  • By nesting conditionals within one another, we can create branching decisions.
  • The logical operator || takes two different boolean values or expressions as its operands and returns a single boolean value. It returns TRUE if either its left operand or its right operand evaluate to TRUE.
  • The logical && operator returns TRUE only if both of its operands evaluate to TRUE. It returns FALSE if either or both of its operands evaluate to FALSE.
  • The logical not operator (!) takes only a right operand. It reverses the boolean value of its operand.
  • The logical exclusive or operator (xor) returns TRUE only if either its left operand or its right operand evaluate to TRUE, but not both or neither.
  • PHP includes alternate syntax for the || and && operators: we can use or in place of ||, and we can use and in place of &&. These operators work much the same way but have different operator precedence.
  • We can include code from one file inside another with include which allows us to write mode modular programs.

Awesome work!

Folder Icon

Take this course for free

Already have an account?