PHP 8.6 is a major update to the language, focused on more expressive code, stronger types and scalable I/O.

The release introduces partial function application, which lets some arguments of a function be supplied in advance and returns a Closure that accepts the rest. It also adds a Duration class that represents elapsed time as measured by a stopwatch. Independent of any time or timezone, it can cover a range of more than 250 years with nanosecond precision, which makes it useful for timeouts and benchmarks.
A new Io\Poll API can monitor many streams at once using the best mechanism available on each platform, such as epoll, kqueue, event ports, or WSAPoll. It avoids the scalability limits of stream_select() and is designed as a foundation for event loop libraries like ReactPHP and AMPHP. The new clamp() function keeps a value, numeric or otherwise, within a given range, returning the nearest boundary when it falls outside. The SortDirection enum offers a shared, type-safe way to express sort order that libraries can accept in their public APIs.
Other changes include readonly properties that can declare default values, parameter-level DocComments available through ReflectionParameter::getDocComment(), and ReflectionProperty::isReadable() and isWritable() methods that check access for a given scope and object. Stream operations can also be configured to throw a StreamException instead of emitting warnings, with errors reported as structured objects.
Source: php.net







