PHP 8.0 Ready To Ship With Many New Features, Even Better Performance

Written by Michael Larabel in Programming on 25 November 2020 at 03:00 PM EST. 16 Comments
PROGRAMMING
PHP 8.0 is scheduled for release tomorrow on the US Thanksgiving day. PHP 8.0 brings with it many new language features on top of the opt-in JIT compiler support. Here is a look at some of the PHP 8.0 changes along with a quick look at the near final performance of PHP 8.0 on an AMD EPYC Linux server.

PHP 8.0 is a very worthy successor to last year's PHP 7.4. Besides the JIT compiler there is a ton of work incorporated into this big version bump. Among the PHP 8.0 highlights are:

- PHP8 introduces the much anticipated Just In Time (JIT) compiler for further enhancing the speed of PHP scripts. More details on PHP's JIT compiler via this Wiki page.

- A number of other performance optimizations were also merged into PHP8.

- JSON support is now considered a core part of the language that's always available rather than being an optional module.

- Support for named arguments for being able to specify the name of arguments rather than their exact order.

- Support for attributes (or also known as annotations or decorators in other languages) for structured metadata on classes / properties / functions / methods / parameters / constants.

- Support for union types that can indicate multiple different types that can be used as parameters or return types on functions.

- Support for a static return type.

- The str_contains() function as an easier way for checking if a string is contained within another string, rather than having to use strpos and the like. Along similar lines are new str_starts_with() and str_ends_with() functions that are self explanatory.

- The Nullsafe operator has been added as a quick and easy way to apply null coalescing behavior on methods.

After PHP 8.0 has set sail I'll be through with some more comprehensive benchmarks, but for those curious below is a quick look at the PHP performance on an AMD EPYC 7742 server with Ubuntu 20.10. Not even with JIT enabled but just the straight-forward performance lift compared to the recent PHP 7.x series:
PHP 8.0 Benchmarking

About a 10% out-of-the-box improvement with PHP 8.0 over the current PHP 7.4 stable series, but at least for some areas more performance can be squeezed with just-in-time compilation. Stay tuned for that data soon and the official PHP 8.0.0 release due out on Thursday.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week