The syntax in two placeholders
- ? stands for exactly one argument, which becomes a required parameter of the generated closure.
- ... stands for "all remaining arguments", and keeps their optionality and default values.
Php
<?php
declare(strict_types=1);
$formatEuros = number_format(?, decimals: 2, decimal_separator: ',', thousands_separator: ' ');
echo $formatEuros(1234.5); // 1 234,50
// same as: static fn (float $num): string => number_format($num, 2, ',', ' ')
Where it really simplifies: the pipe operator
Php
<?php
declare(strict_types=1);
namespace App\Newsletter;
final class RecipientListParser
{
/** @return list<string> */
public function parse(string $input): array
{
return explode(';', $input)
|> array_map(trim(...), ?)
|> array_map(strtolower(...), ?)
|> array_filter(?, $this->isValidEmail(...))
|> array_unique(...)
|> array_values(...);
}
private function isValidEmail(string $email): bool
{
return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
}
}
Pre-configuring a service method
Php
<?php
declare(strict_types=1);
namespace App\Invoice;
use Symfony\Contracts\Translation\TranslatorInterface;
final readonly class InvoiceStatusLabels
{
public function __construct(private TranslatorInterface $translator)
{
}
/** @return list<string> */
public function labels(InvoiceStatus ...$statuses): array
{
$translate = $this->translator->trans(?, domain: 'invoices');
return array_map(
$translate,
array_map(static fn (InvoiceStatus $status): string => 'invoice.status.' . $status->value, $statuses),
);
}
}
The traps
- Arguments are evaluated at creation, not at call time. $log = $this->logger->info(?, ['at' => $this->clock->now()->format(DATE_ATOM)]); freezes the date once and for all, and every message logged through $log will carry the same one. The RFC and Matthew Weier O'Phinney are explicit about it: if an argument must be computed on each call, a classic closure is still required.
- ... forwards extra arguments. Without ..., extra arguments passed to the closure are ignored. With ..., they reach the function and can land in an optional parameter. The RFC's example: array_find() calls its callback with the value and the key, so with intval(...) the key ends up in $base, exactly as with a plain FCC. intval(?) ignores it.
- No new, and a few forbidden functions. new Money(?, Currency::EUR) is not supported (the RFC points to lazy objects, added in PHP 8.4, for the rare use cases); go through a static factory, Money::of(?, Currency::EUR), which works. Functions that depend on the calling context, such as compact(), extract(), func_get_arg(), func_get_args() and get_defined_vars(), cannot be partially applied either, and neither can __get and __set.
Sources
- What's new in PHP 8.6 — stitcher.io, Brent Roose, November 22, 2026
- Getting to Know Partial Function Application in PHP 8.6 — Zend Blog, Matthew Weier O'Phinney, November 19, 2026
- RFC: Partial Function Application (v2) — Larry Garfield and Arnaud Le Blanc, implemented in PHP 8.6
- PHP 8.6 release announcement — php.net, November 19, 2026
- Partial function application — PHP manual