This article writes about what is new in PHP 8.0. These are personal notes related to Symfony UX, taken while attending the “Keynote: What’s new in PHP 8.0?” lecture by Nikita Popov at SymfonyWorld Online 2020.
PHP is constantly improving, adding optimizations and new features. Developers working in the PHP world should welcome these changes with curiosity because it will, at some point, impact their way of working.
At the time when I am writing this article, there is the latest PHP 8.0 release with many new features and optimizations. Nikita Popov made a fantastic overview of the most important ones.
Just in Time (JIT) Compiler compiles PHP code to x86 machine code to improve performance, at least in theory.
To use it we just need to enable opcache and set opcache to antyhing that is not 0 MB, for example opcache.jit_buffer_size=128M
Nikita presented some nice benchmarks on how JIT compiler behaves against various php examples.
Attributes are normal classes that have attribute attribute 🙂 Attributes bythemselves don’t do anything. In order for them to do anything
Some syntax sugar improvements come with constructor promotion. PHP automatically creates corresponding properties and assigns corresponding values.
int|false or int|string|null
It looks like mixed type is the same as no type at all. However, this is not completely true.
mixed for parameters, and mixed for return type, there is a difference.
Replacement or improvement for switch statements.
Match is an expression with return value.
Match performs comparison with strict type comparison === instead of ==.
The latest version of PHP brings lots of new features, with the biggest highlights to the JIT compiler and continued efforts on improving the strongly typed paradigm.
Most of the deprecated functionalities from previous versions are removed in PHP 8.
There is a long term goal to convert all resources to objects in PHP. The reason for this is that objects are type-safe and have much better internal support.
PHP keeps growing and delivering more powerful features. Community is strong and development tools are getting better and better.
It is definitely worth learning about PHP development, either by reading a good book about PHP 8 or surfing online and checking our various tutorials and official documentation.
Read more about SymfonyConference Online 2020 and discover my other notes.
This article is about the code review best practices. It explains code review from the… Read More
API design is an important aspect of modern software development. It allows different systems to… Read More
This article sheds some light related to the question will ChatGPT or AIs in general… Read More
This article provides an overview of new features and deprecations in PHP 8.2. PHP 8.0… Read More
This article is about Automation and Artificial Intelligence in Software Engineering: Experiences, Challenges, and Opportunities.… Read More
PHP is getting more and more features. Enumerations in PHP are one of the latest… Read More