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

Variadic placeholder may only appear once

Description

The … placeholder used for partial function application (PHP 8.5) stands for all of the function’s remaining, not-yet-supplied parameters, which become the parameters of the resulting Closure. Using it more than once in the same call is ambiguous, since there is only one set of “remaining parameters” to represent, so PHP allows at most one placeholder per call.

Example

<?php

function add($a, $b, $c) {
	return $a + $b + $c;
}

$curried = add(..., ...);

?>

Alternatives

  • Use a single … placeholder per call; wrap the result in an extra closure for any additional free parameters.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See