PHP 8.6 is now available at Gigahost! The new version brings useful tools for anyone writing PHP and for the developers behind the software your website runs on.
Here are a few of the highlights:
- Less wrapping for callbacks. With partial function application, you can supply some of a function’s arguments in advance and get a new function that accepts the rest later. That means fewer little wrapper functions throughout your code.
- A new type for durations.
Time\Durationmakes timeouts and timing measurements easier to work with, without having to manage conversions between seconds, milliseconds and nanoseconds yourself. - A handy helper for limits. The new
clamp()function keeps a value within a given range—for example, a percentage that needs to stay between 0 and 100. - Defaults for readonly properties. Values that cannot change after initialization can now be declared directly on the property, leaving a little less work for the constructor.
- New foundations for concurrent connections. A new polling API gives libraries such as ReactPHP and AMPHP a common way to monitor when connections are ready to send or receive data.
You can find more details and code examples in the PHP project’s overview of what’s new.
At Gigahost, you choose the PHP version separately for each domain. Open the domain in the Control Center and select PHP version.
Keep your application and plugins up to date too. Test that everything works after changing the PHP version. If something does not work as expected, you can select the previous version again while you investigate.