Intermediate
PHP
Q56 / 100
What is PHP's match expression's advantage over switch?
Correct! Well done.
Incorrect.
The correct answer is B) match uses strict (===) comparison, has no fall-through, must be exhaustive or throw, and is an expression returning a value
B
Correct Answer
match uses strict (===) comparison, has no fall-through, must be exhaustive or throw, and is an expression returning a value
Explanation
switch uses loose == comparison and allows accidental fall-through. match uses ===, must handle all cases (or have default), and can be assigned directly.
Progress
56/100