syntax error, unexpected token “??”

Description

?? is used as the coalesce operator.

The expression on the left side of that operator must be completed of it to be valid.

Example

<?php

// an unfinished coalesce operation
$a = 1 + ?? 3;

?>

Solutions

  • Finish the expression before the ? in a ternary operation.