PHP 8.6 released with new features and improvements
PHP 8.6.0 has been released, introducing new features such as Partial Function Application, a Duration class, and a Polling API.
PHP 8.6.0 is now available, bringing several updates to the language. This major release aims for faster, safer, and more powerful development. Key features include Partial Function Application, which allows some function arguments to be provided in advance. This returns a Closure that accepts the remaining arguments.
A new \Time\Duration class has been added. It represents elapsed time with nanosecond precision, independent of timezones. This class is suitable for measuring timeouts or benchmark timings. PHP 8.6 also introduces a Polling API for scalable I/O multiplexing. This API uses native mechanisms like epoll and kqueue, providing a foundation for event loop libraries. Additionally, a new clamp() function ensures values fall within a specified range, and SortDirection Enum offers a type-safe way to express sort order. Readonly properties can now declare default values.
Why it matters
These updates enhance PHP's capabilities for building robust and high-performance applications. Features like the Polling API improve I/O scalability, while the Duration class and Partial Function Application offer more expressive and precise coding options.