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

Description

Single colons : are allowed in a method call, as they separate the value and the name of the named parameter. Here, the name of the parameter is missing.

Example

<?php

foo(a:1, : 2);

?>

Solutions

  • Add the name of the parameter before the colon.

  • Remove the colon.