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
Also interesting
Expand your knowledge with the 4BIS Blog...
Software Modernisation, Web development, Managed Hosting, Hosting, Business software, Knowledge Base
Learn how application modernization can help your organization. Discover tips for efficient and cost-effective application modernization.
Read moreAutomate, Logistics, Web development, Software Modernisation, B2B, Saas, Business software, Symfony, PHP, HTML & CSS, MySQL, Bootstrap, Node, React
4BIS Innovations specializes in custom CRM solutions for businesses in Limburg and Maastricht. We offer CRM development, software modernization, and seamless integration to improve efficiency, data management, and customer experience.
Read moreSaas, Web development, Software Modernisation, Business software, Knowledge Base, Automate
Discover how SaaS (Software as a Service) can benefit your business with cost-effective, scalable, and secure solutions. Learn more about SaaS applications and why they're the future of business software.
Read more Do you want to know more or are you interested? Please feel free to contact us directly, by phone or via mail.
Or use one of our contact forms so that we can answer you as quickly and appropriately as possible can give. We would love to hear from you!