The Daily Commit · Section Edition Front Page PHP AI Dev EN DE FR ES

The Php Times

News — Ecosystem

PHP 8.6: Partial Function Application and Readonly Defaults


PHP 8.6, scheduled for November 19, 2026, brings partial function application, readonly property defaults, a new polling API, doc comments for function parameters, and several deprecations.

MEDIUM · PHP, August 9, 2026 curated by Sönke

Two features are highlighted: placeholder-based closures and immutable interface contract properties.

PHP 8.6 is set for release on November 19, 2026. The release includes partial function application, a new polling API, doc comments for function parameters, a set of deprecations, and more.

Partial function application (PFA) lets you create a closure with some parameters already prefilled, using the placeholder syntax: $makeSlug = str_replace(' ', '-', ?); The resulting closure can then be invoked with the remaining argument, e.g. $makeSlug('Hello World');. PFA pairs especially well with the pipe operator, which always requires a callable taking exactly one parameter: $output = 'Hello World' |> str_replace(' ', '-', ?) |> strtolower(...);

The second feature concerns readonly properties. Since PHP 8.4, property hooks can be declared on interfaces, for example: interface MigratesUp { public string $name { get; } public function up(): QueryStatement; }. Before PHP 8.6, readonly properties could not carry default values — a deliberate design decision when readonly was introduced, since a readonly property with a fixed value closely resembles a constant.

With property hooks now usable in interfaces, a default immutable value becomes useful as part of a broader contract. PHP 8.6 therefore allows readonly properties to declare default values, enabling implementations such as final class CreateBooksTable implements MigratesUp { public readonly string $name = '2026-01-01_create_books_table'; ... }.

Read the original source ↗

Rate this article: 0

Readers’ Forum

No contributions yet — open the debate.

← Ecosystem — Page B1

"All the Code That's Fit to Ship" · The Daily Commit · Screen edition · Imprint · Privacy Policy