ТРАНСКРИПЦИЯ 🔗
As PHP 8.6 is due out tomorrow, November 19th, 2026, I wanted to dedicate this episode to the new release, and talk about some of the changes that have most caught my attention, for one reason or another. To be fair, it's not a particularly big release, at least in my opinion. But, I still thought it worth talking about the release and what you can expect all the same.
The first, and arguably most important change is the support for partial function application. Now, at first, that name might seem a little bit odd. But it creates a Closure where one or more arguments can be replaced by the ? placeholder, or the remaining arguments by the splat or ellipsis (...) placeholder. Then, when called, you only need to pass the missing arguments to it.
Quoting PHP.net:
It extends the first class callable syntax, which is the particular case where no argument is provided: any expression that can be called may be used, and the function or method to call is determined when the Closure is created. The question mark, "?" stands for exactly one argument. The corresponding parameter of the Closure is always required, even if the parameter of the original function is optional. And the ellipsis "..." stands for all the parameters that have not been mentioned otherwise. These keep their default values, and a variadic parameter remains variadic. It may only appear once, and must be the last argument.
So, for example, let's say that you want to create a custom call to str_replace, where you're searching for a semicolon in a string and replacing it with a comma. Why? Let's not get too concerned about that right now. It's just a simplistic example which I hope works in podcast format. In that case, you could define a partial function application with those arguments replaced, called semicolon-to-comma just for argument's take. Then, when called, you'd only need pass in the string that you want to run the search and replace on.
What is extra handy about this addition is that it is a convenient way of working with the pipe operator. If you're not familiar with that operator, which was introduced in PHP 8.5, it allows you to chain multiple callables from left to right, taking the return value of the left callable and passing it to the right. If you work with Linux or one or more of the BSDs, then you'll be familiar with the pipe operator, which I believe is available is most of the shells available on those platforms, from which this operator was inspired, most likely.
In short, it lets you create quite sophisticated processing pipelines quite easily, at least from a readability and maintainability perspective.
This new class represents a fixed length of elapsed time with nanosecond precision. Quoting PHP.net:
A duration consists of a non-negative number of whole Time\Duration::$seconds, a number of Time\Duration::$nanoseconds below one second, and a sign stored in Time\Duration::$negative. Unlike DateInterval, a Time\Duration does not have calendar units such as
Load full transcript
days, months or years, because those do not map to a fixed number of seconds: a day can be 23 or 25 hours long across a DST transition, and months have different lengths. The largest unit a duration can be created from is therefore the hour. Use DateInterval for calendar arithmetic on DateTimeImmutable objects, and Time\Duration for unambiguous amounts of time.
The class makes it pretty easy to instantiate objects, by providing a range of from methods, such as fromMicroseconds, fromMilliseconds, fromSeconds, fromMinutes, and so on, and, as you might expect, two duration objects can be compared with PHP's comparison operators, as well as with new class' `compare()` function.
It is now possible to define the __debugInfo() magic method on enums. This method is called by `var_dump()` when dumping an object to get the properties that should be shown. I think this will be pretty handy, allowing for dumping and step-through debugging of enums to find out how they've been initialised, just like any other object in your application.
OpenSSL changes. The extension has added TLS session resumption support for streams, which allows:
1. Saving and restoring client sessions across requests
1. Implementing custom server-side session storage
1. Controlling session cache behavior
The Override attribute can now be applied to class constants, including enum cases. If you're not familiar with the attribute, it's used to indicate that a method, property, or class constant is intended to override a method, a property, or a class constant of a parent class, or that it implements a method, property, or class constant defined in an interface.
So, this change means that if no method, property, or class constant with the same name exists in a parent class or in an implemented interface, a compile-time error will be emitted. I'm progressively using it, but haven't used it a lot, up until this point, I'll admit.
FileInfo: finfo_file() now works with remote streams. Previously, you could use the function to retrieve information about a local file. Now, you can use it to work with files using PHP's native streams functionality. So, you could retrieve file information about files over http, https, ftp, ssh, and more. I've not tested it, but I think that this could be, potentially, quite a worthwhile addition. Let your mind wander and see what use cases you can come up with.
Readonly properties may now declare default values. This one is largely lost on me. And maybe, by talking about it, it will click for me. Let's start with what PHP.net says about this feature:
As of PHP 8.1.0, a property can be declared with the readonly modifier, which prevents modification of the property after initialization. Prior to PHP 8.4.0 a readonly property is implicitly private-set, and may only be written to from the same class. As of PHP 8.4.0, readonly properties are implicitly protected(set), so may be set from child classes. That may be overridden explicitly if desired. A readonly property can only be initialized once, and only from the scope where it has been declared. Any other assignment or modification of the property will result in an Error exception. Readonly properties cannot be unset() once they are initialized. However, it is possible to unset a readonly property prior to initialization, from the scope where the property has been declared.
However, as we've had constructor property promotion since PHP 8.0, and readonly properties since PHP 8.1, I don't see the point in this feature. Honestly, I don't see how it's different from a class constant. Perhaps I'm missing something. If so, please let me know.
Those are the most noteworthy changes in PHP 8.6. As PHP 8.6 is due out tomorrow, November 19th, 2026, I hope you enjoyed this quick recap and that you're keen to play with the new release, if you haven't already. Keep an eye on your package manager of choice for when the new release is available, and get in to it and see how it can help make your PHP code shorter, more readable and maintainable.
For more information on the changes that I've covered, and all of the other changes, check out the release notes. I've linked it in the show notes, as always.