PHP 8.6 full release is here

This year’s annual PHP release features a new polling API, a partial function application feature, and more.

PHP 8.6 has arrived. This year’s annual release has gone through multiple waves of testing, and is now publicly available.

PHP 8.6 is launching at a strange point in time, when PHP is being talked about unusually often on the heels of the PHP2Shell vulnerabilities. If the global reaction to the incident proved anything, it's that the internet still very much relies on PHP. According to W3techs, PHP currently powers about 68.1% of the entire internet. Here at Webslice, PHP is foundational to both Webslice Serverless and Webslice Containers.

Because major PHP updates only roll out once a year, and given the scripting language's prominence, it's always worth taking a look at what's coming down the pipeline with a new release.

What’s new in PHP 8.6? 

Some of the biggest and most noteworthy changes from this year's annual release include:

A new clamp function 

clamp(value,min,max)

A new clamp function returns the given value if it falls within the minimum and maximum bounds. If the value goes above or below the bounds, it gets clamped to its nearest bound. For instance:

clamp(3, min: 0, max: 5); //  RETURNS 3

clamp(7, min: 0, max: 5); // RETURNS 5

clamp(1, min: 3, max: 5); // RETURNS 3

The clamp function is small in terms of scope, but will likely be used by almost anyone scripting in PHP day-to-day.

Partial function application (PFA)

Partial function application, PFA for short, lets you call a function with only some of the arguments filled in—the rest of the arguments get called later. It works by calling a function initially with the arguments that you know, and leaving a ? for the ones you don’t.

$slugs = array_map(str_replace(' ', '-', ?), $names);

In the above example, the ? expression prevents str_replace() from being called immediately. It instead creates a closure that waits for the final argument to be run.

Default values for readonly properties

With PHP 8.6, you can give readonly properties a default value. Readonly properties were introduced way back in PHP 8.1 (November, 2021), but you were unable to define default values for readonly properties.

A long list of features

The full list is too long to break down in depth, but some of the highlights on the list include:

  • Native Polling API: High-performance I/O polling using epoll, kqueue, and WSAPoll.
  • #[\Override] for class constants: The Override attribute can now be applied to class constants, including enum cases.
  • Good for catching broken constant overrides and typos at compile time.
  • Error messages returned by json_last_error_msg() now provide additional information.
  • New SortDirection global enum added, designed to replace ambiguous strings and boolean flags.

For a comprehensive list of new features, check out the official PHP 8.6 release page.

What’s deprecated with 8.6?

New versions don’t just introduce new features. Old features are also phased out to accommodate upcoming changes and future planning.

Noteworthy features that will become deprecated with PHP 8.6 include:

  • Using namespace as a class constant name:

const NAMESPACE = ‘ ‘;

  • Returning from a finally block: 

finally {  return []}; }

  • Using let or is as identifiers:

function let() {} class is() {}

  • Declaring a return type of ?array for __debugInfo(). Declare array instead.

  • Mbregex functions have been deprecated because its underlying Oniguruma library is no longer maintained.

  • Returning values from _construct() or destruct() is deprecated.

  • Using long php://filter chains with more than 16 filters will now give a deprecation warning.

To see a full list of deprecated features and functions, check out the official list on the PHP 8.6 migration manual.

It’s worth noting that PHP 8.6 doesn’t introduce any backwards incompatible changes with PHP. However, the new clamp() function in particular means that “clamp” will no longer be available as a function name and could break older user implementations.

Which PHP versions are actually supported?

As with any major software update, there’s no immediate rush to update to the newest version. 

In saying that, the PHP Foundation (the official maintainers of PHP) can only offer simultaneous support for a finite amount of PHP versions.

While it's not unheard of to run older, unsupported versions of PHP, the value of running “Actively supported” versions of PHP became quite apparent when PHP2Shell patches were released.

The general rule of thumb is that PHP versions are “actively supported” for approximately 2 years following their release, and then receive security and vulnerability support for another 2 years after that.

As of 17 November 2026, the following versions of PHP are officially supported:

Version Status Active support ends Security fixes end
PHP 8.5 Active support December 31, 2027 December 31, 2029
PHP 8.4 Active support December 31, 2026 December 31, 2028
PHP 8.3 Security fixes only December 31, 2025 December 31, 2027
PHP 8.2 Security fixes only December 31, 2024 December 31, 2026

The urgent detail there is that PHP 8.2 will stop receiving security fixes at the end of 2026. Given the severity and avalanche of vulnerabilities, teams on PHP 8.2 should really be thinking about an upgrade plan. PHP 8.3 is on the same course, just one year down the line.

And at the end of the year, PHP 8.4 will stop receiving active support and move into that “security fixes only” status.

Timelines for PHP 8.6 aren’t yet provided in the PHP documentation because it’s still in active development.

Is PHP 8.6 safer than PHP 8.5?

Back in October, PHP made front page news like we’d never seen before with PHP2Shell. Server maintainers and web hosting companies scrambled to roll out vulnerability updates and mitigations, to keep their servers and their customers safe.

Things move very quickly these days. Keeping your software, PHP or otherwise, up-to-date is one of the most best steps you can take to

This new version of PHP 8.6 has fixes for PHP2Shell baked in (just like all PHP versions going back to 8.2 already do). 

As always, there are also many new security measures being introduced by default in the 8.6 version upgrade. These specifically focus on session management and cookie protections:

  • session.use_strict_mode = 1

  • session.cookie_httponly = 1

  • session.cookie_samesite = Lax

Is it the fastest PHP version yet?

As the developers of WordPress speed test plugin PHP Vitals, one big question on our minds is whether PHP 8.6 offers a performance boost over earlier versions. PHP versions tend to be quicker than their predecessors, but there’s never any guarantee.

Every benchmarking test submitted to the PHP Vitals leaderboard displays the user's PHP version, letting users from all over the world see for themselves which version of PHP runs quickest. PHP 8.6 tests have already started flying in, and it seems to be performing almost as quickly as 8.5 (although it's early days at this point).

If you want to see how quickly PHP 8.6 runs compared to other versions on your web host, install the PHP Vitals plugin and run benchmark tests before and after upgrading your PHP version to compare. Each test only takes a couple of minutes.

Sooner, rather than later

All Webslice Containers and Webslice Serverless images are already PHP 8.2 or higher, but if you have any other projects still using end-of-life PHP versions like 8.1 and older, then you'll want to get off those as soon as possible.

You'll also want to upgrade from PHP 8.2 sooner rather than later too, with 8.2 entering end-of-life December 31, 2026.

Webslice Containers will offer PHP 8.6 images in the future, once we've gone through thorough testing of the new version. We'll let you know when that time comes.

With production websites, you wouldn't normally rush to upgrade your PHP version. In saying that, keeping your PHP version as updated as possible provides an extra layer of defense against vulnerabilities. We recommend updating your PHP version once your framework/CMS supports it, and you've tested that everything is working as intended. You don't want to be stuck on an old unsupported PHP version scrambling to get a PHP upgrade completed overnight if a new major vulnerability drops.

Keep reading