PHP 8.6 came out on November 19, 2026. The headline features are partial function application, a Duration class for time spans, a polling API and a long-awaited clamp(). Below is what is new with code examples, what has been deprecated, what can actually break your site, and a step-by-step plan for upgrading on shared hosting or a VPS with a way back if something goes wrong.
PHP 8.6 at a glance: release date and support
PHP releases a new minor version every November. Each version gets two years of active support (bug and security fixes) and then two more years of security-only fixes. Here is where the current branches stand according to php.net/supported-versions as of November 23, 2026:
| Version | Released | Active support until | Security fixes until |
|---|---|---|---|
| 8.6 | Nov 19, 2026 | Dec 31, 2028 | Dec 31, 2030 |
| 8.5 | Nov 20, 2025 | Dec 31, 2027 | Dec 31, 2029 |
| 8.4 | Nov 21, 2024 | Dec 31, 2026 | Dec 31, 2028 |
| 8.3 | Nov 23, 2023 | ended | Dec 31, 2027 |
| 8.2 | Dec 8, 2022 | ended | Dec 31, 2026 |
| 8.1 and older | — | ended | ended |
Two things follow from the table. First, PHP 8.2 gets its last security fix at the end of December 2026, so sites on 8.2 need to move this winter regardless of 8.6. Second, nobody is forced onto 8.6 yet: 8.4 and 8.5 are fully supported, and for many sites they are the more sensible target right now. Whichever branch you stay on, install the November 19 patch releases first — see PHP security update November 2026.
New features in PHP 8.6 with examples
The full list is on the release page and in the RFCs on wiki.php.net. Here are the changes you are most likely to use in everyday code.
Partial function application
The biggest syntax change. You call a function with some arguments filled in and placeholders for the rest, and instead of a result you get a Closure that waits for the missing arguments. A question mark ? stands for exactly one argument, three dots ... for all remaining ones (only at the end). It is a generalisation of the first-class callable syntax strlen(...) from PHP 8.1.
<?php
// PHP 8.5 and older: a wrapper closure for every fixed argument
$escape = fn (string $s): string => htmlspecialchars($s, ENT_QUOTES, 'UTF-8');
$titles = array_map($escape, $titles);
// PHP 8.6: partial function application
// ? = exactly one argument goes here later
$titles = array_map(htmlspecialchars(?, ENT_QUOTES, 'UTF-8'), $titles);
// ... = "all remaining arguments", must be last
$log = sprintf('[%s] %s: %s', ...);
echo $log(date('H:i'), 'cron', 'done');
// Named placeholders work too
$toUtc = date_create(?, timezone: new DateTimeZone('UTC'));
$start = $toUtc('2026-11-19 10:00');
// Pairs nicely with the pipe operator from PHP 8.5
$slug = $title
|> trim(...)
|> strtolower(...)
|> str_replace(' ', '-', ?);The resulting closure keeps parameter names, types and defaults of the original function, so static analysers understand it. Limits from the RFC: you cannot partially apply a constructor (new Foo(?) is not allowed, a static factory method is), and a positional placeholder cannot come after a named argument.
clamp()
Keeps a value within a range: below the minimum you get the minimum, above the maximum you get the maximum. It replaces the max(min(...)) construct, where it is easy to swap the arguments. It works with any comparable values, not only numbers. If the minimum is greater than the maximum, or either bound is NAN, it throws ValueError.
<?php
// Before: easy to mix up min and max
$page = max(1, min($page, $totalPages));
// PHP 8.6
$page = clamp($page, 1, $totalPages);
clamp(150, 0, 100); // 100
clamp(-5, 0, 100); // 0
clamp(5, 10, 1); // ValueError: min is greater than max
// Careful: if $totalPages can be 0, guard it first
$page = clamp($page, 1, max(1, $totalPages));Time\Duration
A class for an amount of elapsed time — timeouts, delays between retries, benchmark results. Unlike DateInterval, it has nothing to do with calendars or time zones and stores time with nanosecond precision. Durations can be added, multiplied and compared directly.
<?php
use Time\Duration;
// Before: a bare int, and nobody remembers if it is ms or µs
usleep(250000);
// PHP 8.6: the unit is in the name
$retryDelay = Duration::fromMilliseconds(250);
$maxDelay = Duration::fromSeconds(30);
// Durations are comparable, so min(), max() and clamp() work
$delay = min($retryDelay->multiplyBy(2 ** $attempt), $maxDelay);
time_nanosleep($delay->seconds, $delay->nanoseconds);Polling API (Io\Poll)
A new API for watching many streams and sockets at once. Under the hood PHP picks the best mechanism for the platform — epoll on Linux, kqueue on BSD and macOS, WSAPoll on Windows — instead of stream_select(), which in practice tops out at about 1024 connections. This matters to authors of event loops and async libraries like ReactPHP and AMPHP; ordinary sites will get it indirectly, through those libraries. Details are in the poll_api RFC.
Smaller but useful
<?php
// Readonly properties can now have a default value
final readonly class ApiConfig
{
public string $baseUrl = 'https://api.example.com';
public int $timeout = 10;
}
// One shared enum for sort order instead of 'asc', SORT_DESC, true...
function sortProducts(array $items, SortDirection $dir = SortDirection::Ascending): array
{
usort($items, fn ($a, $b) => $dir === SortDirection::Ascending
? $a['price'] <=> $b['price']
: $b['price'] <=> $a['price']);
return $items;
}
// Stream errors as exceptions instead of warnings
$ctx = stream_context_create(['stream' => ['error_mode' => StreamErrorMode::Exception]]);
try {
$json = file_get_contents('/var/www/app/config.json', context: $ctx);
} catch (StreamException $e) {
error_log('Config not readable: ' . $e->getMessage());
}- Doc comments on parameters — each parameter can have its own
/** ... */, readable viaReflectionParameter::getDocComment(). #[\Override]now also works on class constants and enum cases.mysqli::quote_string()escapes and quotes a string, likePDO::quote().- JSON errors now include the position of the error in the input — debugging a broken payload gets easier.
- Performance:
array_map()with a first-class callable or a partial application is compiled into a loop;printf()and JSON encoding got faster.
What is deprecated and what can break
Two different things are mixed up here, and it is worth keeping them apart. Deprecations produce an E_DEPRECATED notice and nothing else: the code keeps running on 8.6, and the feature is usually removed in a later major version. Behaviour changes take effect immediately, and they are the ones that break sites.
Deprecated: what to replace it with
| Deprecated in 8.6 | Use instead |
|---|---|
return inside finally | return in try/catch, only cleanup in finally |
is_integer(), is_long(), is_double(), doubleval() | is_int(), is_float(), floatval() |
spl_object_hash() | spl_object_id() |
mb_ereg(), mb_split() and other mbstring regex functions | preg_* with the u modifier |
strcoll(), the SORT_LOCALE_STRING flag | the Collator class (intl) |
Third argument to define() | drop it |
Returning a value from __construct() / __destruct() | no return value |
Custom session handlers without create_sid() and validateId() | implement both methods |
Passing an object where an array is expected to array_walk(), http_build_query() | get_object_vars($obj) first |
metaphone(), mysqli_get_charset(), mysqli_stmt_init() | see the migration guide on php.net |
let, is as names of classes, functions, constants | rename |
The most common one in older code is return in finally. It not only triggers a notice, it hides real errors:
<?php
// Deprecated in 8.6: return inside finally swallows the exception
function load(string $path): ?string
{
try {
return read_file_or_throw($path);
} finally {
return null; // E_DEPRECATED, and the exception is lost
}
}
// Fix: clean up in finally, return outside it
function load(string $path): ?string
{
try {
return read_file_or_throw($path);
} catch (RuntimeException $e) {
error_log($e->getMessage());
return null;
} finally {
release_lock($path);
}
}Behaviour changes that hit immediately
- Session defaults.
session.use_strict_modeandsession.cookie_httponlyare now enabled, andsession.cookie_samesitedefaults toLax. For security this is a good thing. But if your code reads the session cookie from JavaScript, or a payment provider sends the customer back to your site with a cross-site POST request, the session may be missing after the switch. Test checkout and login flows separately. trim(),ltrim(),rtrim()now also strip the form feed character\fby default.ValueErrorinstead of silence. Many functions now throw for invalid flags, out-of-range values or strings containing NUL bytes, where they used to quietly truncate or ignore the input.fclose(),file_put_contents(),copy()now returnfalseif flushing or closing the stream fails — code that ignored the return value will not notice, code that checks it will.- Extensions. Binary extensions have to be built for 8.6. Commercial plugins encoded with ionCube need an ionCube Loader for the new version, and it usually appears some time after the PHP release. Check on the vendor’s site before switching.
WordPress, Laravel, Symfony: is it compatible?
Status of the official pages as of November 23, 2026:
| Project | Officially supported PHP | PHP 8.6 |
|---|---|---|
| WordPress 6.9 / 7.0 / 7.1 | 7.4 – 8.5 | not in the compatibility table yet |
| Laravel 13 | 8.3 – 8.5 | not in the support table yet |
| Laravel 12 | 8.2 – 8.5 | not in the support table yet |
| Symfony 8.1 | 8.4 and newer | no separate statement on the releases page |
| Symfony 7.4 LTS | 8.2 and newer | no separate statement on the releases page |
Sources: the WordPress PHP compatibility table, Laravel 13 release notes, symfony.com/releases. “Not in the table” does not mean “does not work”: these projects test against new PHP versions during the beta phase and fix issues in patch releases. It means nobody has promised it yet.
For WordPress the weak spot is almost always plugins and themes, not core. Look at the “Tested up to” and “Requires PHP” fields in each plugin’s description and at the changelogs of commercial plugins. For Composer projects check the require.php constraint of every dependency — the command below shows which package is holding you back. If you are thinking about leaving WordPress altogether, see WordPress alternatives. The next core release, WordPress 7.2, is due on December 8, 2026 — what changes in it and how to prepare is in WordPress 7.2: release date and 12 changes.
Front-end tools that connect with a script tag do not care about the PHP version at all — the Sitecog widget and CMS, for example, work the same on PHP 7.4 and 8.6.
How to check your project before upgrading
Never test on production. You need either a local environment with PHP 8.6 or a copy of the site on a subdomain where the PHP version can be switched separately.
# Which PHP runs the CLI and which one the site uses can differ
php -v
php -m # loaded extensions
# Ask Composer what blocks PHP 8.6 (alias: composer prohibits)
composer why-not php 8.6
# Run on a machine that already has 8.6: are the platform requirements met?
composer check-platform-reqs
# Syntax check of your own code with the new binary
find . -name '*.php' -not -path './vendor/*' -print0 | xargs -0 -n1 php8.6 -l | grep -v 'No syntax errors'
# Tests
php8.6 vendor/bin/phpunitNext, collect deprecation notices. Some only appear when a specific code path runs, so let the staging copy live for a while: click through the main pages, submit forms, place a test order, run the cron jobs.
<?php
// Put at the very top of the bootstrap on the STAGING copy only.
// Collects every deprecation notice into a separate log.
error_reporting(E_ALL);
ini_set('display_errors', '0');
set_error_handler(function (int $no, string $msg, string $file, int $line): bool {
if ($no === E_DEPRECATED || $no === E_USER_DEPRECATED) {
error_log('[php86] ' . $msg . ' in ' . $file . ':' . $line . PHP_EOL, 3, __DIR__ . '/deprecated.log');
return true; // handled, do not pass on
}
return false; // everything else goes to the normal handler
});Static analysis finds deprecated calls without running the code. In PHPStan set phpVersion: 80600 in phpstan.neon (if your PHPStan version already knows 8.6), and Rector can rewrite many outdated constructs automatically:
<?php
// rector.php: shows what can be modernised; run with --dry-run first
use Rector\Config\RectorConfig;
return RectorConfig::configure()
->withPaths([__DIR__ . '/src'])
->withPhpSets(); // reads the PHP version from composer.jsonBefore switching, make sure that:
- tests pass on 8.6 and the deprecation log contains nothing from your own code (notices from
vendor/are a reason to update packages); - login, registration, cart and payment return work — this is where the new session defaults show up;
- every extension the project needs is present:
php8.6 -magainstphp -mon the current version; - cron jobs, queues and CLI commands run on the new version too, not only the web server.
How to switch PHP version on hosting and roll back
Shared hosting with a control panel
- Make a backup of files and the database — via the panel or your own scripts. Check that it can actually be restored.
- Find out if the host offers 8.6 at all. In cPanel the version is set in MultiPHP Manager or “Select PHP Version”, in Plesk under PHP Settings for each domain. New versions usually appear there days or weeks after release.
- Switch the staging subdomain first, check it as described above.
- Switch production at a quiet hour and watch the error log for the first day.
- Rollback is the same switch back to the previous version. Clear the CMS cache afterwards; OPcache resets when PHP-FPM restarts.
VPS with nginx and PHP-FPM
On your own server, install 8.6 alongside the current version. Then switching and rolling back come down to changing one line in the nginx config:
# Debian / Ubuntu, if your repository or PPA already ships 8.6:
# install the new version NEXT TO the old one, do not remove the old one
sudo apt install php8.6-fpm php8.6-cli php8.6-mysql php8.6-mbstring \
php8.6-xml php8.6-curl php8.6-intl php8.6-zip php8.6-gd
# Compare extension lists: anything missing in 8.6?
diff <(php8.5 -m) <(php8.6 -m)
# Point nginx at the new socket:
# fastcgi_pass unix:/run/php/php8.6-fpm.sock;
sudo nginx -t && sudo systemctl reload nginx
# Cron jobs and artisan/wp-cli use the CLI version, switch it too
sudo update-alternatives --set php /usr/bin/php8.6
# Rollback = the same two steps back to 8.5
# fastcgi_pass unix:/run/php/php8.5-fpm.sock;
sudo nginx -t && sudo systemctl reload nginx
sudo update-alternatives --set php /usr/bin/php8.5Should you upgrade to PHP 8.6 right away?
| Your situation | What to do |
|---|---|
| PHP 8.1 or older | Upgrade now to 8.4 or 8.5 — these versions get no security fixes anymore. |
| PHP 8.2 | Move to 8.4 or 8.5 before December 31, 2026. 8.6 can come later. |
| PHP 8.3–8.5, WordPress site | Wait until 8.6 appears in the WordPress compatibility table and your key plugins confirm it. |
| PHP 8.3–8.5, Laravel / Symfony | Add 8.6 to CI now, switch production after the framework confirms support. |
| New project | Develop on 8.6 if all dependencies install without workarounds. |
A practical rule of thumb: let the first patch releases come out (PHP ships them roughly every month) and give your host and your dependencies time to catch up. Use that time to clean up the deprecation log — then the actual switch takes five minutes, and rolling back takes just as long.
If you are choosing a platform for a new site and want to compare options, start with what a CMS is and how to choose one.
Laravel itself now goes beyond PHP: what the betas offer and whether to care is in Laravel Go and Laravel Rust.
Frequently asked questions
When was PHP 8.6 released?
PHP 8.6.0 was released on November 19, 2026. According to php.net, it gets active support (bug fixes) until December 31, 2028 and security fixes until December 31, 2030.
What are the main new features in PHP 8.6?
Partial function application with ? and ... placeholders, the Time\Duration class, the Io\Poll polling API, the clamp() function, the SortDirection enum, exceptions for stream errors, default values for readonly properties and per-parameter doc comments. There is also a long list of deprecations and a few behaviour changes, notably safer session defaults.
Does WordPress work on PHP 8.6?
As of November 23, 2026, the official WordPress PHP compatibility table ends at PHP 8.5 (supported in WordPress 6.9, 7.0 and 7.1) and says nothing about 8.6. Core may well run, but plugins and themes are the usual weak spot. For production WordPress sites, PHP 8.4 or 8.5 is the safe choice until 8.6 appears in that table.
Does Laravel support PHP 8.6?
As of November 23, 2026, the support table in the Laravel 13 release notes lists PHP 8.3 to 8.5 for Laravel 13 and 8.2 to 8.5 for Laravel 12. PHP 8.6 is not listed yet. Test on a copy with your full test suite and wait for an official update before switching production.
Will my code break after upgrading to PHP 8.6?
Deprecations only produce E_DEPRECATED notices: the code keeps working. Real breakage comes from behaviour changes: session.use_strict_mode and cookie_httponly are now on by default and SameSite defaults to Lax, trim() also strips form feed characters, and many functions throw ValueError for invalid flags or strings with NUL bytes. Old extensions that are not built for 8.6 yet (ionCube Loader is the usual suspect) stop the site from starting.
Should I upgrade to PHP 8.6 right away?
For development and testing — yes. For production, it makes sense to wait for the first patch releases and for your CMS or framework to confirm support. If you are on PHP 8.2 or older, do not wait for 8.6: security support for 8.2 ends on December 31, 2026, and 8.4 or 8.5 is a safer target today.
