1.2.751. Named Argument And Variadic¶
Variadic argument must be the last in the list of arguments. Since PHP 8.1, it is possible to use named arguments after a variadic argument.
<?php
// named arguments may be after the variadic
foo(...$a, a: 1);
// positional arguments MUST be before the variadic
foo(...$a, 1);
// Normal way
foo( 1, ...$a);
?>