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 variable “%s”, expecting “(”

Description

In a function definition, the name of the function is separated from the argument list by an opening parenthesis. This is missing here. This applied to closures, arrow functions and methods’ signatures.

Example

<?php

    function foo $name: , $value = 1) {}
    function bar ) {}

?>

Alternatives

  • Add the missing opening parenthesis.
  • Provide a value for the parameter name in the functioncall.