
Website Building for Local Entrepreneurs
Want to have a website built quickly and professionally for your hair salon, bakery or local shop? 4BIS takes care of everything for you: fast online, easy to find and without...
Wait a little while and then the new version of PHP comes from version 8.0. This brings a lot of fun new functions such as the Jit Compiler, Union types, and attributes. I will briefly discuss these 3 things so that you get an idea of what the coming version entails.
Time has almost arrived and I am not talking about the birthday of Sinterklaas, no I am talking about the release of the new version of PHP. PHP 8.0 will be released on November 26. This a major release and ensures that there will be a number of important changes, as well as many new functionalities and performance improvements.
Because there are a number of important changes, you may have to update your code to make it run at PHP 8.0. But if you have kept your PHP versions up to date, the upgrade to version 8 should not be too difficult since most Breaking Changes are already outdated for the 7.* versions. And no worries, we list the outdated functions.
Union Types
A Union type can accept values of several different types instead of 1. In the current version of PHP this is not accepted with the exception of 2 special Union types
The RFC requests whether we can support Union Types in function signs from now on, so that we are no longer dependent on inline documentation, but they can specify with the Syntax T1 | T2 ... More about Union types
Just-in-time (JIT) Compiler is one of the features that will be set live with PHP 8.0. The Jit Compiler was already in for test purposes, but it is now ready to be used. It should ensure a significant performance increase. PHP is not compiled, but rule interpreted by rule. JIT is a technique that compiles parts of the code during Runtime, so that the compiled version can be used instead. Think of it as a "crepse version" of the interpreted code, which is generated during runtime.
Pedro Escudero has already tested JIT. It has used a simple script to test different versions of PHP Performance. He has run this script 100x and caught the average time. Below you can see the benchmark results:
Version | Time in seconds |
5.3 | 0.64574003219604 |
7.4 | 0.10253500938416 |
8.0 (without JIT) | 0.098223924636841 |
8.0 (with JIT) | 0.053637981414795 |
As you can see, the difference between 7.4 and 8.0 without jit is not very significant. But with the Jit Compiler, performance is improved by around 45%.
Attributes
Attributes are declarative metadata that between "< <" and "> >" to stand. They can be added to other parts to specify properties. Another name for attributes is Annotations. This is a term known from doctrine both are often used interchangeably. PHP has gone specifically for the name attributes to prevent the confusion with doctrine as much as possible.
str_contains()
str_Contains is one of the new functions that has taken a while. This allows you to see if a string is in a different string and you no longer have to use str_pos ().
We have now discussed some of the large features, but there are of course more. Do you want to know what else can be done in PHP 8.0. Then click below
As you can read, version 8.0 brings us a lot of exciting and fun new features that can bring a lot of new fun things. As mentioned it is a major release so there may be things that could break your code. But if you have kept your code up-to-date, it must all be better than expected. In any case, I can't wait to play with PHP 8.0
Ook interessant
Breid je kennis uit met de 4BIS Blog...
Want to have a website built quickly and professionally for your hair salon, bakery or local shop? 4BIS takes care of everything for you: fast online, easy to find and without...
Discover how app development can move your business forward. 4BIS creates customised apps that really work - personal, scalable and affordable.
Discover 4BIS Innovations' new chat feature in the customer portal for seamless, real-time communication and enhanced client support.
Wil je meer weten of heb je interesse? Neem dan gerust direct contact met ons op, per telefoon of via de mail.
Of maak gebruik van één van onze contactformulieren zodat we je zo snel en gepast mogelijk antwoord kunnen geven. We horen graag van je!