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 token “,”

Description

A comma is used to separate arguments in a function call. A functioncall may also use named parameters, to identify the arguments. In this case, the name of the parameter is provided, but not its value.

Example

<?php

    #[Attribute(name: , value: 1)]
    class X {}

?>

Alternatives

  • Remove the parameter name from the function call.
  • Provide a value for the parameter name in the functioncall.