Technology1 min read

PHP 8.6 is released!

By · Published by Everything Blog

In short

The release introduces partial function application, which returns a closure accepting remaining arguments when supplied with an initial subset. Developers can also utilize a dedicated clamp function to easily restrict numbers within set boundary ranges. Furthermore, it incorporates high-precision time tracking through a nanosecond-level duration utility alongside support for readonly property defaults that resolve previous compile-time interface issues.

Key points

  • Readonly property defaults are now permitted, eliminating a previous compile-time error w…: Readonly property defaults are now permitted, eliminating a previous compile-time error when satisfying get-only interface properties.
  • New factory methods and native comparison support within the duration class significantly…: New factory methods and native comparison support within the duration class significantly improve precision timing tasks.
  • The update incorporates changed defaults, new functional programming tools, and deprecati…: The update incorporates changed defaults, new functional programming tools, and deprecations across the broader language environment.

Sources checked by our analysis pipeline: 1

PHP 8.6 is now out! This post covers the new features, changed defaults, and deprecations in the release. For the release announcement, see our full What's new in PHP 8.6 post.

PHP 8.6 Features

- Partial function application (PFA) lets you call a function with some arguments filled in and get back a closure that takes the rest.

- Clamp Function returns the value if it falls within the bounds, or the nearest bound if it does not

- A Time\Duration Class, a final readonly class that represents a stopwatch-style length of time with nanosecond precision. It has factory methods for each unit, arithmetic methods, and comparison support:

- Readonly Property Defaults, readonly properties can have a default value. Before 8.6 this was a compile-time error, which made it awkward to satisfy get-only interface properties from PHP 8.4 with a fixed value

- Plus much more!

You can check out our coverege of What's new in PHP 8.6 and the official PHP 8.6 landing page.

Technology