The new PHP 8 stable version is finally released!
The new version of PHP introduces a whole bunch of changes, improvements and new features.
What’s the biggest feature introduced in PHP 8? Let’s find out.
PHP JIT (Just-in-Time Compiler)
PHP is an interpreted language. This means that it is not compiled like Java (or C for example). PHP is translated to machine code at runtime. The biggest thing which is coming with PHP 8 is the Just-in-time (JIT) compiler. Let’s dive in!
JIT is a technology that will compile the code partially at runtime, and this compiled version will be used later. Think of it as a cached version of the interpreted code generated at runtime.
Probably you are asking yourself, what will this bring to my PHP-based project? The new compiler promises it will significantly improve the performance. In the video below you can see how the calculations are faster if we use PHP 8(JIT) and PHP 7. The video is from Zeev Surasky, co-author of the JIT proposal for PHP 8.
Okay, but how does that work?
Without much specifics, there is a tool called “monitor” that will observe the code as it is running. When the monitor notices a code that has been re-executed, it will be marked as “warm” and “hot” depending on the frequency it is executed. These “hot” parts of code are compiled as optimized machine code and used later instead of the real code. Yes, probably you are thinking that this looks like the technology behind OPCache. Yes, you are correct, but there is a difference between OPCache and the JIT compiler.
The question is very complex and we can not answer it in the frames of this blog post. It's enough to understand that the JIT compiler may improve the performance of your PHP project outstandingly.
New features introduced in PHP 8
If we move our focus out of the new PHP JIT compiler, we see a bunch of changes and improvements that are coming with PHP 8. It is believed that these changes will make PHP more reliable and efficient.
The changes and features introduced in the new major version of PHP 8 would make quite a list and our blog post will never be enough to describe and show them.
The major changes in the new version are:
Constructor Property Promotion
Validation for Abstract Trait Methods
Arrays Starting With a Negative Index
And plenty of others. You can check all the changes and their description here.
Also, with PHP 8, there are a few new functions that are announced:
When will PHP 8 be available for all VPSBG shared hosting accounts?
For us, it is very important to offer the best and latest technologies available. So very soon the new version of PHP 8 will be available for use on your VPSBG shared hosting service.
We have tried to cover all the biggest things that are coming with the new version. Probably, the most anticipated feature is the new JIT compiler, which will bring a significant boost to your PHP application.
We are extremely excited about the new PHP 8 version, and the things it will bring to the world. We are super impatient to test it. Are you?