syntax error, unexpected identifier “%s”, expecting “)”

Description

This error appears an argument is already a complete expression, yet a new identifier appears after it. Within a method call, this could have been the end of the call itself, or an expression error.

Example

<?php

foo(a: 1 b: 2);

foo(a: 1 c);

?>

Literal Examples

  • syntax error, unexpected identifier “b”, expecting “)”

Solutions

  • Add the missing comma between the arguments.

  • Add the missing operator to build a full expression. There may be many ways to make the expression valid.

  • Close the function call with a closing parenthese, and start a new expression after it.