Bird
0
0

Which logical operator in PHP returns true only if both conditions are true?

easy📝 Conceptual Q11 of 15
PHP - Operators
Which logical operator in PHP returns true only if both conditions are true?
A&& (AND)
B|| (OR)
C! (NOT)
Dxor
Step-by-Step Solution
Solution:
  1. Step 1: Understand the AND operator

    The AND operator && returns true only if both conditions it connects are true.
  2. Step 2: Compare with other operators

    The OR operator || returns true if at least one condition is true, NOT ! negates a condition, and xor returns true if exactly one condition is true.
  3. Final Answer:

    && (AND) -> Option A
  4. Quick Check:

    AND = both true [OK]
Quick Trick: AND means both must be true to get true [OK]
Common Mistakes:
  • Confusing OR (||) with AND (&&)
  • Thinking NOT (!) combines two conditions
  • Assuming xor behaves like AND

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PHP Quizzes