syntax error, unexpected token “match”

Description

In PHP 8.0, the match statement was added to PHP feature: it is a similar feature to switch. match is now a PHP reserved keyword, and, as such, cannot be used everywhere. For example, it cannot be used as a class, function or interface name; it cannot be used in a function call, although it may be used in method call.

Example

<?php

$x = match ($a) {};

?>

Solutions

  • Change the name to something else than match.