PHP 8.6 vs PHP 8.5: What's New and Should You Upgrade?
PHP 8.6 shipped November 19, 2026. We compare it feature-by-feature against PHP 8.5 and give a clear upgrade verdict for new projects, production apps, and legacy codebases.

PHP 8.6.0 reached general availability on November 19, 2026, and the short answer for anyone running PHP 8.5 is: this is a small, largely additive release. There's no new operator syntax on the scale of PHP 8.5's pipe operator, no JIT overhaul, and no sweeping type-system change. The real work is in a long list of narrower fixes — default values for readonly properties, partial function application, a new Time\Duration class, and dozens of places where PHP now throws a ValueError instead of silently coercing bad input. A few of those changes can break existing code, particularly around magic-property resolution, array_intersect(), and session cookie defaults, so they're worth testing before you upgrade production. If you're still on PHP 8.3 or earlier, read this as one combined upgrade decision rather than two separate ones — the PostgreSQL 19 vs PostgreSQL 18 breakdown we published covers the same "should I skip a version" logic for your database layer.
The essentials:
- PHP 8.6.0 shipped November 19, 2026 (GA), one day after our PHP 8.6 release-date news coverage.
- PHP 8.5 shipped November 20, 2025, and introduced the pipe operator,
#[\NoDiscard], and fatal-error backtraces. - PHP 8.6's headline Core features: default values for readonly properties, partial function application, reference assignment on
WeakMap, and endianness modifiers forpack()/unpack(). - Highest-risk breaking changes:
??/empty()behavior on classes using__isset(),array_intersect()string-conversion timing, and three changed session INI defaults (session.use_strict_mode,session.cookie_httponly,session.cookie_samesite). - Our verdict: safe to adopt for new projects and most PHP 8.4/8.5 production apps after a test pass; legacy PHP 8.1–8.3 codebases should upgrade to 8.5 first, then 8.6.
What's actually new in PHP 8.6
PHP 8.6's own migration guide splits its additions across Core and a long list of extensions. The Core changes are the ones most PHP developers will actually touch:
- Default values for readonly properties. A readonly property, including inside a readonly class, can now declare a default value. PHP treats the default as the property's one allowed initialization, so it still can't be reassigned afterward — even from inside the constructor.
- Partial function application. A new syntax lets you pre-fill some arguments of a function call and get back a
Closure: use?to mark the argument you want to leave open, and...to leave all remaining arguments open.$addOne = add(1, ?);then$addOne(5)returns 6, andstr_replace(' ', '', ?)becomes a reusable one-argument closure. - Reference assignment on
WeakMap. You can now write$map[$obj] = &$count;without the key already existing in the map. #[\Override]on class constants, including enum cases — PHP raises a compile-time error if there's no matching parent or interface constant to override.- Mutating objects stored in constants. If a class constant holds an object, you can now write to its properties, e.g.
CONFIG->debug = true;. - Endianness modifiers for
pack()/unpack(). The format codess S l L q Q f dcan now take a trailing<(little-endian) or>(big-endian) modifier for binary-protocol work. __debugInfo()on enums is now allowed (previously a fatal error) and is used byvar_dump().
Outside Core, the two most notable additions are a new Time\Duration class — an immutable, nanosecond-precision elapsed-time type with factories like fromSeconds() and fromIso8601DurationString(), arithmetic methods, and comparison support — and a new low-level I/O polling API under the Io\Poll namespace. OpenSSL also picks up TLS session resumption, external PSK, and TLS 1.3 early data (0-RTT) support for streams, and PDO_PGSQL gains a chunked-fetch attribute (Pdo\Pgsql::ATTR_CHUNK_SIZE) for lazily streaming large result sets.
What PHP 8.5 already gave you
If you're jumping from 8.4 straight to 8.6, you're really absorbing two releases' worth of change at once, so it's worth knowing what arrived in PHP 8.5 (released November 20, 2025):
- The pipe operator (
|>), which threads a value through a chain of callables:"Hello World" |> strlen(...). #[\NoDiscard], an attribute that warns when a function's return value is ignored, paired with an explicit(void)cast to suppress the warning when that's intentional.cloneas a callable function that accepts a$withPropertiesparameter, letting you reassign properties — including readonly ones — during cloning.- Backtraces on fatal errors, including max-execution-time errors, which makes production debugging noticeably easier.
- Closures and first-class callables allowed inside constant expressions, attribute parameters, and default property/parameter values.
- A built-in
uriextension implementing both RFC 3986 and WHATWG URL parsing.
PHP 8.5 also made Opcache a permanently built-in, always-loaded component — the --enable-opcache/--disable-opcache build flags and the separate opcache.so module are gone, though the opcache.enable and opcache.enable_cli INI settings still work the same way.
PHP 8.6 vs PHP 8.5 at a glance
| Area | PHP 8.5 (Nov 2025) | PHP 8.6 (Nov 2026) |
|---|---|---|
| Headline syntax addition | Pipe operator |> | Partial function application (? / ...) |
| Readonly properties | No default values allowed | Default values allowed (count as the one initialization) |
| Return-value discipline | #[\NoDiscard] + (void) cast | No new attribute of this kind |
| Cloning | clone usable as a function with $withProperties | No change |
| Error visibility | Fatal errors gained backtraces | No new error-visibility feature |
| Date/time | No calendar-free duration type | New Time\Duration class (nanosecond precision) |
| I/O | No generic polling API | New Io\Poll namespace |
| Opcache | Became permanently built-in | No change |
| Session security defaults | Unchanged from 8.4 | use_strict_mode and cookie_httponly default to on; cookie_samesite defaults to "Lax" |
| Risk profile for upgraders | Low — mostly additive | Low-to-moderate — a handful of targeted behavior changes |
Backward-incompatible changes to test for
None of PHP 8.6's breaking changes are as disruptive as, say, a major type-system shift, but several are the kind that silently change behavior rather than throwing an obvious error, which makes them easy to miss in a quick review:
- Magic-property resolution order. If a class defines
__isset()in a way that itself writes the property (a common pattern for lazy-loaded properties), code like$obj->foo ?? 'default'now returns the value__isset()just wrote, instead of calling__get()afterward. Any lazy-property pattern built around that two-step dance needs a look. array_intersect()string conversion timing. With two or more input arrays, values are now converted to strings while scanning the inputs, not while sorting them. That changes the order and count of warnings and__toString()calls, and can change results for objects with stateful__toString()implementations.- Session INI defaults changed:
session.use_strict_modeflips from0to1,session.cookie_httponlyflips from0to1, andsession.cookie_samesitegoes from unset to"Lax". These are good security defaults, but a site relying on cross-site POSTs into a session cookie will needSameSite=Noneplussession.cookie_secure=1explicitly, or logins will start failing after the upgrade. - Form feed (
\f) is now trimmed by default intrim(),ltrim(), andrtrim()— a one-line behavior change that can quietly affect string-parsing code that depended on the old behavior. - New
ValueErrors appear across a wide set of functions that previously accepted bad flags, out-of-range numbers, or embedded NUL bytes silently or with just a warning —array_filter(),number_format(),sleep(),parse_str(),proc_open(), and roughly twenty file-path functions among them. Code that relied on PHP quietly ignoring malformed input in these calls will now need a try/catch or input validation. unpack()endianness modifiers change how a leading<or>after a format code is parsed — it's now a modifier rather than part of the result key name, sounpack('s<value', ...)now returns the key"value"instead of"<value".
Several extensions pick up stricter validation too — DOM, GD, GMP, Intl, PCNTL, Sockets, Sodium, and Zip all gained new TypeError/ValueError throws for inputs that used to fail more quietly. If your test suite exercises those extensions directly, re-run it against 8.6 before deploying.
Deprecated in 8.6, on the way out in PHP 9.0
PHP's migration guide treats its deprecation list as effectively a preview of PHP 9.0. The ones most likely to show up in an existing codebase's deprecation log:
returninside afinallyblock now emits a compile-time notice, because it silently discards whatever exception or return value thetryblock produced.- The entire family of mbregex functions (
mb_ereg,mb_ereg_replace,mb_split, and others) is deprecated because the underlying Oniguruma engine is no longer maintained; PHP 9.0 will remove them in favor of PCRE with theumodifier. - Passing objects to
array_walk(),array_walk_recursive(), orhttp_build_query()— callget_object_vars()first instead. - Old type-check aliases:
is_double(),is_long(),is_integer(), anddoubleval()— useis_float(),is_int(), andfloatval(). spl_object_hash()(usespl_object_id()) andspl_classes()(useReflectionExtension::getClassNames()).mysqli_stmt_init()andmysqli_get_charset(), both with direct replacements already noted in the migration guide.
Performance and runtime notes
PHP 8.6's own migration guide has no dedicated performance section, and we found no official benchmark claims from the PHP project for this release — treat any specific speed-up percentage you see elsewhere as unverified until a primary PHP.net source publishes one. The closest things to runtime-relevant changes are architectural rather than raw-speed: the new Io\Poll API gives extension and framework authors a standard way to multiplex socket/stream readiness instead of rolling their own stream_select() wrapper, and PDO_PGSQL's new chunked-fetch attribute can reduce memory pressure on very large result sets by streaming rows instead of buffering them all at once. Neither changes typical request-response performance for a standard web app.
Should you upgrade now?
Our read, based on the scope of changes above:
- New projects: start on PHP 8.6. There's no reason to begin a new codebase on 8.5 at this point, and the new readonly-property defaults and partial function application are genuinely useful from day one.
- Production apps already on PHP 8.4 or 8.5: upgrade is low-risk, but budget a short test pass specifically targeting session handling (check your
SameSite/cookie-security configuration against the new defaults), any class using__isset()for lazy properties, and any code callingarray_intersect()with objects that have side-effecting__toString()methods. - Legacy codebases on PHP 8.1–8.3: don't skip straight to 8.6. Upgrade to 8.5 first and resolve its own backward-incompatible changes (PDO fetch-mode constructor semantics, destructuring warnings, the Opcache build changes) before layering 8.6's changes on top — trying to diagnose two major versions' worth of behavior changes at once makes root-causing failures much harder.
- Anything still using mbregex functions,
spl_object_hash(), or the mysqli legacy methods listed above: start migrating now. They're not removed yet, but 8.6 is your warning window before PHP 9.0.
What to do next
Pull the official PHP 8.6 migration guide and run your test suite against a PHP 8.6 build in a staging environment before touching production — the backward-incompatible changes above are the complete list from PHP's own documentation, not a cherry-picked subset. If your stack also depends on a database upgrade this cycle, our PostgreSQL 19 vs PostgreSQL 18 comparison walks through the same kind of staged-upgrade decision. And if any part of your application still leans on a Node.js-based service alongside PHP, our Bun vs Node.js runtime comparison is a useful companion read for teams weighing a broader backend refresh at the same time.
Frequently asked questions
When was PHP 8.6 released?
PHP 8.6.0 reached general availability on November 19, 2026, according to the official PHP releases page.
What is the single biggest new feature in PHP 8.6?
There's no one dominant feature the way the pipe operator defined PHP 8.5. The most broadly useful additions are default values for readonly properties and partial function application, which lets you pre-fill some of a function's arguments and get back a reusable closure.
What's the riskiest change when upgrading from PHP 8.5 to 8.6?
The changed session INI defaults. session.use_strict_mode and session.cookie_httponly now default to on, and session.cookie_samesite defaults to "Lax" — a site that relies on cross-site POST logins needs to explicitly set SameSite=None with cookie_secure=1, or those logins will start failing.
Can I upgrade directly from PHP 8.3 or earlier straight to PHP 8.6?
Technically yes, but we recommend upgrading to 8.5 first and resolving its own backward-incompatible changes, like PDO's stricter fetch-mode constructor behavior, before adding 8.6's changes on top, so you're not debugging two major versions' worth of behavior shifts at once.
Does PHP 8.6 remove any functions outright?
No. PHP 8.6 deprecates several things — including the entire mbregex function family and spl_object_hash() — as a warning ahead of PHP 9.0, but nothing is removed in 8.6 itself.
Where can I read the full, official list of PHP 8.6 changes?
PHP's own migration guide at php.net/manual/en/migration86.php, which breaks changes down into New Features, Backward Incompatible Changes, Deprecated Features, and Other Changes.
Sources
- PHP: Migrating from PHP 8.5.x to PHP 8.6.xphp.net
- PHP: PHP 8.6.0 Releasedphp.net
- PHP: Migrating from PHP 8.4.x to PHP 8.5.xphp.net
- php-src on GitHubgithub.com
Felix Moreau writes Pandromeda's software coverage and how-to guides. He covers Windows, macOS and Linux updates, the apps people rely on, emulators and developer tools, and turns official documentation into clear, numbered steps that work on the current version.

