syntax error, unexpected token “continue”¶
Description¶
continue
is a token that stop the current loop or switch
, and proceed from the end of that loop. continue
is standalone expression, and cannot be part of another expression: this is why it is forbidden in the array, or the match
command.
Example¶
<?php
// break does not fit everwhere
$a = [1 => continue ];
// break is for switch, not match
$b = match($c) {
1 => continue,
};
?>
Solutions¶
Remove the continue, and find another way to jump out of the loop.