PHP 8.6 landed on 19 November 2026, three days ago. It is not a quiet maintenance release: partial function application, a real Duration type, a native polling API, and a clamp() function headline a release that also ships a long deprecation list and tighter session defaults. This guide walks through the PHP 8.6 new features that will actually change how you write code, with copy-paste examples, and then covers what to fix before you upgrade — including where Laravel and WordPress stand today, 22 November 2026.
One thing up front: do not upgrade for speed. Tideways benchmarked Laravel 13 on PHP 8.5 and 8.6 and got 792.70 requests per second on 8.5 against 792.33 on 8.6 — effectively identical. The reason to move is the language, not the clock. And if you are still on PHP 8.2, the calendar is doing the deciding for you: security support for 8.2 ends on 31 December 2026.
1. Partial function application: the headline feature
Partial function application (PFA) lets you call a function with some arguments filled in and placeholders for the rest. PHP does not run the function — it returns a closure that runs when you supply the remaining arguments. The placeholders are ? for one argument and ... for the rest, and they work with named arguments too.
Before 8.6, pre-filling an argument meant writing an arrow function:
$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];
$supported = array_filter(
$versions,
fn ($version) => version_compare($version, '8.6', '>='),
);
In PHP 8.6, the placeholder does the same job in one expression:
$versions = ['8.4', '8.5', '8.6', '8.7', '9.0'];
$supported = array_filter(
$versions,
version_compare(?, '8.6', '>='),
);
Named arguments work as well. The official release notes show a retry helper pre-configured with its delays, leaving only the attempt number open:
$waitBeforeRetry = backoff(
Duration::fromSeconds(1),
Duration::fromMilliseconds(100),
attempt: ?,
);
$waitBeforeRetry($attempt);
Where this earns its keep in real code: callbacks. Anywhere you currently write fn ($x) => someHelper($fixed, $x) — array_map, array_filter, collection callbacks, event listeners — a partial does it without the wrapper. Two things to remember. First, this is new syntax, so the code only runs on PHP 8.6 everywhere it executes, including CI. Second, there is a real performance side effect: PHP 8.6 compiles array_map() calls that use a first-class callable or a partial into the equivalent loop, skipping the intermediate closure.
2. Time\Duration: stopwatch time, finally typed
The new Time\Duration class represents elapsed time — the kind of time a stopwatch measures — independent of dates, timezones, and daylight saving. It holds nanosecond precision across a range of more than 250 years, which makes it the right type for timeouts, retry delays, and benchmark timings.
Today your config is full of bare integers where the unit lives in your head: retry_after => 90, $timeout = 120, $backoff = [1, 5, 10]. Is 90 seconds or milliseconds? Duration ends that guessing:
use Time\Duration;
function backoff(
Duration $baseDelay,
Duration $step,
int $attempt,
): void {
$delay = $baseDelay->add($step->multiplyBy(2 ** $attempt));
// Durations are comparable, so min() works directly.
$delay = min($delay, Duration::fromSeconds(30));
time_nanosleep($delay->seconds, $delay->nanoseconds);
}
backoff(
Duration::fromSeconds(1),
Duration::fromMilliseconds(100),
$attempt,
);
Factory methods cover every unit you will reach for: fromNanoseconds(), fromMicroseconds(), fromMilliseconds(), fromSeconds(), fromMinutes(), and fromHours(). Durations support add(), multiplyBy(), and direct comparison with min() and max(), and they read through ->seconds and ->nanoseconds properties.
One honest caveat: Laravel’s APIs do not accept Duration yet, so for now you convert at the boundary — $duration->seconds into the config value that expects an integer. Use it in your own code now; framework adoption will follow, the same way Carbon became the standard for dates.
3. clamp(): stop writing min(max()) backwards
PHP 8.6 adds a global clamp() function that keeps a value inside a range. If the value is inside the range it comes back unchanged; otherwise you get the nearest boundary:
var_dump(clamp(-10, 0, 100)); // int(0)
var_dump(clamp(50, 0, 100)); // int(50)
var_dump(clamp(110, 0, 100)); // int(100)
That replaces the max(0, min($value, 100)) pair, which is easy to get backwards and hard to read at a glance. Two details make it more than syntactic sugar. First, the argument order is clamp($value, $min, $max) — value first. Second, it works on any comparable value, not just numbers, so it composes with the new Duration class:
var_dump(clamp(
\Time\Duration::fromSeconds(30),
min: \Time\Duration::fromMinutes(1),
max: \Time\Duration::fromMinutes(10),
)->seconds);
// int(60)
Laravel developers already have Number::clamp(), but that is numbers-only. PHP’s version works on anything comparable, so reach for it in plain PHP code, validators, and anywhere you clamp a timeout, a percentage, or a pagination offset. One warning: if your codebase or a helper file already defines a global clamp() function, it will now collide with PHP’s. Search for it before you upgrade.
4. SortDirection: one enum to sort them all
Every library used to define its own way to express sort order — 'ASC' strings, SORT_ASC integers, booleans, custom enums — and they were all incompatible with each other. PHP 8.6 ships a global SortDirection enum with two cases, Ascending and Descending, so libraries can accept it in their public APIs without adapter code:
class QueryBuilder
{
private array $orderBy = [];
public function orderBy(
string $column,
SortDirection $direction = SortDirection::Ascending,
): static {
$this->orderBy[] = $column . ' ' . match ($direction) {
SortDirection::Ascending => 'ASC',
SortDirection::Descending => 'DESC',
};
return $this;
}
}
$qb->orderBy('name', SortDirection::Descending);
Pass the old SORT_STRING integer by mistake and you now get a TypeError at the call site instead of an UnhandledMatchError deep inside the method. Laravel has already started adopting it: the query builder accepts SortDirection since Laravel 13.8 and collections since 13.7, and Laravel 13.7 and later require symfony/polyfill-php86, which backports both clamp() and SortDirection (plus grapheme_strrev()) to PHP 8.3. That means you can use both of these features in a Laravel app today without running PHP 8.6 at all.
5. Readonly property defaults: fixed values without a constructor
Readonly properties arrived in PHP 8.1 with one awkward rule: no default values, because a property that can only be set once seemed to have no use for one. Property hooks in PHP 8.4 changed the picture — interfaces can now declare get-only properties — and 8.6 finishes the job: readonly properties, including ones in readonly classes, can declare a default value. The default counts as the property’s initialisation, so the constructor cannot overwrite it.
The before and after, from the official release notes:
interface Rule
{
public string $parser { get; }
}
final readonly class SlugRule implements Rule
{
public string $parser;
public function __construct()
{
$this->parser = SlugParser::class;
}
}
interface Rule
{
public string $parser { get; }
}
final readonly class SlugRule implements Rule
{
public string $parser = SlugParser::class;
}
This is a small change with a big effect on DTOs and value objects: fixed values in a readonly class no longer need a constructor whose only job is assignment. If your codebase is full of one-line constructors that only set readonly properties, 8.6 lets you delete them.
6. The polling API: plumbing for async PHP
The new Io\Poll API is the feature most developers will never call directly — and the one that matters most for the ecosystem. It monitors many streams at once using the best mechanism on each platform (epoll on Linux, kqueue on macOS/BSD, event ports, or WSAPoll on Windows), without the scalability limits of stream_select(), which typically cannot handle more than 1,024 connections.
use Io\Poll\{Context, Event};
$server = stream_socket_server('tcp://0.0.0.0:8080');
// Automatically uses epoll, kqueue, event ports, or WSAPoll
$poll = new Context();
$poll->add(new StreamPollHandle($server), [Event::Read]);
while (true) {
foreach ($poll->wait() as $watcher) {
$stream = $watcher->getHandle()->getStream();
if ($stream === $server) {
$client = stream_socket_accept($server);
$poll->add(new StreamPollHandle($client), [Event::Read]);
continue;
}
$data = fread($stream, 8192);
if ($data === '' || $data === false) {
$watcher->remove();
fclose($stream);
} else {
fwrite($stream, $data);
}
}
}
The API is deliberately minimal in 8.6: it polls streams and nothing else. It is built as a common foundation for event loop libraries such as ReactPHP and AMPHP, so the practical payoff arrives when those libraries — and Laravel Reverb, which sits on ReactPHP — adopt it and get faster for free. If you write long-running PHP daemons, queue workers, or websocket servers, this is the release to watch, not the release to rewrite for.
7. Smaller wins worth knowing
Beyond the headlines, 8.6 ships a set of focused improvements:
#[\Override]on constants. The attribute now works on class constants and enum cases, so the compiler catches a constant override that no longer matches its parent — the same typo protection methods have had since 8.3.__debugInfo()on enums. Enums can now implement the magic method, sovar_dump()output for an enum shows what you choose instead of the default.- Writes to objects stored in constants. You can now modify a property of an object held in a constant directly, for example
Config::DEFAULTS->timeout = 30. - URI builders. PHP 8.5 added the
Uriextension for parsing; 8.6 adds the other half —Uri\Rfc3986\UriBuilderandUri\WhatWg\UrlBuilder— plus new methods for detecting URI and host types and aUri\WhatWg\url_percent_encode()function. - JSON errors that tell you where. JSON error messages now include the location of the error in the input, so a malformed payload points at the byte offset instead of just failing.
- Stream errors as exceptions. Stream operations can be configured to throw a
StreamExceptioninstead of emitting warnings, with structuredStreamErrorobjects carrying aStreamErrorCodeenum case, the wrapper name, and the path. Set'error_mode' => StreamErrorMode::Exceptionin the stream context; errors can also be retrieved later withstream_last_errors(). grapheme_strrev(). The intl extension gains a grapheme-safe string reversal, so reversing a string with emoji no longer scrambles it. There is also a newIntlNumberRangeFormatterclass for formatting number ranges.mysqli::quote_string(). Escapes a string and wraps it in quotes, matchingPDO::quote()— long overdue for code still on mysqli.- Parameter DocComments. Function and method parameters can now carry their own DocComments, readable via the new
ReflectionParameter::getDocComment()method, instead of repeating every name and type in a@paramblock. - Reflection read/write checks.
ReflectionProperty::isReadable()andisWritable()answer directly whether a property can be read or written in a given scope, taking visibility, initialisation state, hooks, and magic methods into account. - Sodium goes post-quantum. The Sodium extension adds post-quantum key encapsulation (X-Wing and ML-KEM-768), IP address encryption, and the SHAKE and TurboSHAKE extendable-output functions.
- Error arguments, consistently. The new
error_include_argsINI setting includes function arguments in error messages the same way everywhere.
8. What breaks: the deprecation list to work through
PHP 8.6 carries a long deprecation list, most of it accepted in a single mass-deprecation vote. A deprecation is a warning, not an error — your app keeps running — but every item on the list is slated for removal in PHP 9, so treat the list as a work queue, not background noise. The ones a typical Laravel or WordPress codebase is most likely to meet:
| Deprecated in 8.6 | Use instead |
|---|---|
return inside a finally block |
Restructure the code — a return in finally silently discards exceptions |
Returning a value from __construct() or __destruct() |
Return nothing from constructors and destructors |
mb_ereg(), mb_split() and the other mbstring regex functions |
PCRE functions with the u modifier — the Oniguruma library behind them is no longer maintained |
is_double(), is_long(), is_integer(), doubleval() |
is_float(), is_int(), floatval() |
spl_object_hash() |
spl_object_id() |
strcoll() and the SORT_LOCALE_STRING flag |
The Collator class from intl |
Passing a third argument to define() |
Two-argument define() |
metaphone(), mysqli_get_charset(), mysqli_stmt_init() |
Their modern equivalents |
Session handlers without create_sid() and validateId() |
Implement both methods |
Three behaviour changes deserve attention even though they are not deprecations. First, sessions are more secure by default: session.use_strict_mode and session.cookie_httponly are now enabled and session.cookie_samesite defaults to Lax. Laravel manages its own session cookies, so most Laravel apps are unaffected, but apps using native PHP sessions will feel it. Second, trim(), ltrim(), and rtrim() now also strip form feed (\f) characters by default. Third, fclose(), file_put_contents(), and copy() now return false when flushing or closing the stream fails instead of silently ignoring the failure — check return values you previously ignored. And many functions now throw a ValueError for out-of-range values, invalid flags, or strings containing NUL bytes instead of silently truncating them.
Laravel’s own session handlers gained create_sid() and validateId() in 13.31 and 13.32, so the framework’s built-in drivers are covered. The deprecations most likely to show up in a Laravel app’s logs come from vendor packages, not your code — which is why the upgrade advice below starts with CI, not production.
9. Should Laravel and WordPress developers upgrade yet?
Laravel: test now, move production later. As of 20 November 2026, Laravel 13 officially supports PHP 8.3 to 8.5. The support pull request (#61771) was ready for review on 20 November but had not merged, and most of the ecosystem does not run 8.6 in CI yet. Composer will not stop you — laravel/framework requires "php": "^8.3", which already allows 8.6 — but vendor deprecation notices will show up in your logs. The sensible sequence is: update Laravel to the latest 13.x first, add PHP 8.6 to your CI matrix as an allowed-failure job, run composer why-not php 8.6 to find packages whose constraints exclude it, and move production once your key packages test clean and your host offers 8.6. Forge, Laravel Cloud, and most managed hosts add new PHP versions within days to weeks of release.
WordPress: wait for 7.2. WordPress 7.2 Beta 5, published 10 November 2026, resolved all known PHP 8.6 compatibility issues in core, and the developer blog notes core’s unit tests on PHP 8.6 are no longer allowed to fail. But 7.2 is still at release-candidate stage, with the stable release scheduled for 8 December 2026, and the compatibility table still lists PHP 8.5 as the newest version for WordPress 7.1. Switching a 7.1 site to 8.6 today means running it on a PHP version it was never officially tested on. The real risk is not core anyway — it is plugins. WordPress’s own audit found spl_object_hash() in 2,359 plugins and is_long() in 2,258. Before you flip the switch, grep your plugins and theme for the deprecated functions, then test on a staging copy with WP_DEBUG_LOG enabled. And remember the date that actually matters: if your site still runs PHP 8.2, security fixes stop on 31 December 2026. Move to 8.3 or newer before then, even if it is not 8.6.
The upgrade checklist, in order:
- Check what you run today:
php -von the CLI and the version your web server actually uses — they are often different. - Find blockers:
composer why-not php 8.6in a Laravel app; a grep for deprecated function names acrosswp-content/pluginsand your theme on WordPress. - Search your own code for a global
clamp()function or aSortDirectionclass — both now collide with PHP’s. - Add PHP 8.6 to CI, turn on deprecation logging (
LOG_DEPRECATIONS_CHANNEL=singlein Laravel), and fix what surfaces. - Test on staging first, then move production once your host offers 8.6 and your packages are clean.
PHP 8.6 is a language release, not a speed release. Partial function application and Duration are the two features you will actually reach for weekly; clamp() and SortDirection clean up code you have already written; and the polling API is groundwork for faster async PHP down the line. The upgrade itself is straightforward for most apps — the work is in the deprecation list and in waiting for your framework to bless the version. Start that work now, in CI and on staging, and the production switch becomes boring. That is exactly what you want it to be.
Verified against the official PHP 8.6 release notes and supported-versions page on 22 November 2026. Laravel and WordPress compatibility status as of 20 November 2026.
Further Reading & References
- PHP 8.6 Release Announcement — php.net
- PHP Supported Versions — php.net
- Everything New in PHP 8.6 — Nuno Maduro
- PHP 8.6 Ships: Here’s What’s New — Kinsta
- PHP 8.6 for Laravel and Filament Apps — Packstub
- PHP 8.6 for Laravel Developers: 5 Features Worth Using — DEV Community
- What’s New in PHP 8.6 and What That Means for WordPress — WordPress Developer Blog
- PHP Benchmarks: 8.6 vs 8.5, 8.4, and 7.4 — Tideways
- PHP 8.6 Ships 19 November — and PHP 8.2 Dies 31 December: The Upgrade Checklist — HowToShipIt



