Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

Description

This error is a variation of the named parameter typo: the missing semi colon between the name and the value leads to an identifier next to an unrelated operator. The suggestion to use a closing parenthesis is valid, though not the only one.

Example

<?php

foo(arg new B());

class B {}

function foo(B $arg) {}

?>

Alternatives

  • Add the missing : before the integer.
  • Add the missing ) before the integer, and may be a comma, depending on the context.