← Thu, Nov 19 digest

What's New in PHP 8.6

read article ↗ hn thread ↗

PHP 8.6 introduces Partial Function Application, a Duration class, a scalable Polling API, a clamp() function, and sort direction enums.

summary is enough The release notes list the new features, syntax changes, and deprecations clearly, making it easy to skim for relevant updates.

summary

PHP 8.6 brings major additions including Partial Function Application using placeholder syntax, a native Duration class for precise time measurement, and an Io Poll API for scalable I/O multiplexing. It also introduces helpful utilities like a built-in clamp() function, SortDirection enums, and readonly property defaults. Additionally, the release deprecates several legacy functions and aliases while tightening default security settings.

key points

  1. Partial Function Application uses question mark and ellipsis placeholders to bind arguments in advance and return a closure.
  2. The new Io Poll API provides native, scalable I/O multiplexing via epoll and kqueue without stream_select limitations.
  3. The Duration class handles elapsed time with nanosecond precision over a 250-year range.
  4. Numerous legacy functions and aliases, such as mb_ereg() and is_double(), have been officially deprecated.

who should read it

PHP developers and backend engineers looking to update their codebase with modern language features.

discussion positive

consensus

Commenters are generally enthusiastic about modern PHP features like partial function application and improved stream error handling, though many quickly pivoted to discussing concurrent security vulnerability disclosures.

pushback

Some developers expressed skepticism over the chosen syntax for partial function application, particularly the use of question mark placeholders.

best comment by beberlei ↗

Most excited about the ZTS overhead reduction. If you are unfamiliar PHP can run either with or without thread safety (think using pthreads in PHP requests).

If the overhead can be further reduced (and people have ideas) then it could be that we only need ZTS mode anymore in the future and that can open up one avenue for PHP to get native async support similar to the existing parallel extension: https://github.com/krakjoe/parallel

More "hands-on" is the stream error handling improvements. This greatly improves the old file stream APIs to now allow throwing exceptions instead of returning …

It highlights under-the-hood improvements like ZTS overhead reduction while providing a clean example of the new stream error handling.

Generated by an LLM from the article and thread. Check the sources before relying on it.