PHP 8 Basics — The Match Expression
As of PHP8.0 a new expression was introduced, it is a powerful feature and it will often be the better choice compared to using switch.
(PHP 8) The
matchexpression branches evaluation based on an identity check of a value. Similarly to a
matchexpression has a subject expression that is compared against multiple alternatives. Unlike
switch, it will evaluate to a value much like…