syntax error, unexpected identifier “%s”

Description

This error appears when two identifiers are following each other. This is usually rooted in a missing keyword or character.

Named structures usually start with a keyword, such as class, interface, function, etc.

In a function call, a missing opening parenthese brings the named parameter and the function name together.

Example

<?php

// missing starting class or interface keyword
A extends B {}

// missing opening parenthese
foo name:1);

?>

Literal Examples

  • syntax error, unexpected identifier “A”

Solutions

  • Add the missing keyword before the identifier.

  • Add a missing opening parenthese to the function call.