
PHP 8.6 brings partial function application, new duration class & push toward scalable I/O
The PHP development team has released PHP 8.6, a major update to the language that introduces several long-requested features aimed at making code more expressive and better suited to modern, high-concurrency workloads. Headlining the release is partial function application, a new language capability that lets developers fix some of a function's arguments in advance, using ? and ... placeholders for the rest, and receive a Closure that can be completed later. Alongside it, PHP 8.6 adds a standard SortDirection enum with Ascending and Descending cases, ending the long-standing patchwork of incompatible integers, strings, booleans, and custom enums used by libraries to represent sort order.
Performance and infrastructure also take center stage. The new Io\Poll API brings scalable I/O multiplexing to the language, using platform-native mechanisms such as epoll, kqueue, event ports, and WSAPoll to monitor many streams at once without the scalability limits of stream_select(). The API is designed as a shared foundation for event loop libraries like ReactPHP and AMPHP, signaling PHP's continued push into asynchronous, event-driven territory. Under the hood, the release speeds up array_map() with first-class callable callbacks, printf() calls, and JSON encoding, while introducing caching of stateless closures.
Rounding out the update are a handful of developer-friendly additions: a \Time\Duration class for representing elapsed stopwatch time, a clamp() function that keeps values within a specified range, read-only properties that can now declare default values, and in-memory archive support via ZipArchive::openString() and closeString(). Not everything in 8.6 is purely additive; the release deprecates return statements inside finally blocks, which previously could silently discard exceptions, a change consistent with PHP's ongoing effort to eliminate error-prone language constructs.
No comments so far, maybe you want to be first?


