What is the 'Match' expression in PHP 8, and how does it differ from a 'Switch' statement?

Last updated 15 June 2026

  • match is an expression that returns a value you can assign directly, while switch is a statement that only executes blocks.

  • match uses strict === comparison (no type juggling) and has no fallthrough, so no break is needed. switch uses loose ==.

  • An unmatched value throws UnhandledMatchError instead of silently doing nothing. Multiple conditions can share one arm using commas.

  • https://stackoverflow.com/questions/65131495/what-are-the-difference-between-php-8-match-expression-vs-php-7-switch-case
All PHP interview questions