1. Home
  2. Computer Science MCQs
  3. PHP
  4. How does PHP 8's match expression differ from a switch…

Added 2 Nov 2026

How does PHP 8's match expression differ from a switch statement?

  1. It works only with integer conditions
  2. It needs a break after every case arm
  3. It uses strict comparison and returns a value Correct answer
  4. It uses loose comparison and falls through

Correct answer

C. It uses strict comparison and returns a value

15 views

MCQSEXAM

Explanation

match compares with ===, has no fall-through, returns a value directly and throws UnhandledMatchError when no arm matches, so it is safer and more concise than switch.

Reference

Asked in: NTS, PHP Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is C? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More PHP MCQs

Practise all PHP MCQs

Similar MCQs