syntax error, unexpected token “;”, expecting “)”

Description

A semi-colon was found after an opening parenthesis. To keep the code balanced, PHP expects the parenthesis to be closed before finishing the instruction.

Example

<?php

array(1,2; );

foo(3,4;);

function foo($a = 3;) {}
?>

Solutions

  • Remove the semi-colon.

  • Close the parenthesis before the semi-colon.