XAMPP PHP Named Arguments gives " syntax error, unexpected ':', expecting ')'"

82 Views Asked by At

In an include file I declare a function

function patch_163_output_row_header(
    string $title,
    string $label,
    $help,
    bool $read_only=false,
    bool $required=false,
    string $label_cell
    )

and when I compile this using the XAMPP PHP compiler (8.1.6 as far as I can tell) it is OK In another file I try to use the function

    patch_163_output_row_header(
        title:$title,
        label:$label,
        help:$help,
        read_only:$read_only,
        required:$required,
        label_cell:$label_cell
        );

when I try to compile I get the error mentioned above on the"title" line.

I can see no obvious issues - title does not seem to be a reserved word?

The strange thing then is that these two files are part of a website and when they are executed by the same XAMPP stack (presumably using the same PHP compiler?) there are no errors reported and they work.

0

There are 0 best solutions below