Intermediate PHP
Q48 / 100

What is the match expression in PHP 8?

Correct! Well done.

Incorrect.

The correct answer is B) A strict-comparison expression that returns a value, replacing switch with no type juggling or fall-through

B

Correct Answer

A strict-comparison expression that returns a value, replacing switch with no type juggling or fall-through

Explanation

match($val) { 1 => "one", 2 => "two" } uses === comparison, throws UnhandledMatchError for no match, and has no fall-through.

Progress
48/100