RC RANDOM CHAOS

PHP 8.6 Adds Partial Functions, Duration Type, and Scalable I/O

· via Hacker News

Original source

What's New in PHP 8.6

Hacker News →

PHP 8.6, released in November 2026, strengthens the language with new type-safe features and improved I/O capabilities. Partial Function Application lets developers fix some arguments to a function and return a closure for the remaining parameters, supporting cleaner, more modular code. A new Duration class represents elapsed time with nanosecond precision and can express spans exceeding 250 years, making it ideal for timeouts and performance measurements. The clamp() function standardizes boundary checking for comparable values, while a new SortDirection enum replaces ad-hoc sort constants with type-safe alternatives shared across libraries.

The release addresses server scalability through a new Polling API that replaces stream_select(), which is typically limited to 1024 concurrent connections. The API abstracts over platform-specific mechanisms like epoll and kqueue, enabling efficient monitoring of many streams without scalability constraints. Stream operations now support structured exception handling via StreamErrorCode enums and StreamError objects, allowing applications to handle specific error conditions and retrieve detailed context rather than relying on suppressed warnings. Readonly properties can now declare default values, eliminating the need for constructor assignments.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.