New PHP Release: What Changed
The developer community is once again in anticipation: the PHP team has released another significant language update. The new release, numbered PHP 8.4, brings not only long-awaited syntactic improvements but also serious work on bug fixes, performance, and security. Let's break down the most important changes that everyone writing PHP needs to know.
Key Syntax Innovations
One of the main highlights of the release is the implementation of property hooks. This feature, long awaited by the community, allows you to define the logic for getting and setting class property values directly, without writing getters and setters manually. The code becomes cleaner and more compact.
- Property hooks: Now you can write
public string $name { get => ...; set => ...; }directly in the property declaration. - Explicit asymmetric types: The ability to specify different types for the getter and setter (e.g., publicly return
string|null, but only acceptstring). - Improved syntax for callable types: Added support for more flexible description of callback functions.
Performance and JIT Compilation
The PHP core developers continued optimizing the engine. In the new release, the JIT compiler (Just-In-Time) has been significantly improved. For typical web scenarios (WordPress, Laravel, Symfony), the performance gain ranges from 5% to 15% without any changes to the project code. This was made possible by improved type analysis at the compilation stage.
- Loop optimization: JIT now handles long loops and mathematical operations better.
- Reduced memory consumption: In some array processing scenarios, RAM usage has been reduced by 10-12%.
- Fast parser: The loading and parsing process for large files with classes has been accelerated.
Security and Deprecated Functions
Every new PHP release is also a "cleanup" of the codebase. Developers are actively removing outdated constructs that could be unsafe or confuse beginners.
- Function removal: The
mysqli_fetch_allfunction in deprecated styles and some E_STRICT notices have been permanently removed. - Stricter typing: Built-in functions now throw TypeError if they receive arguments of the wrong type (previously it was just a warning).
- New attributes: The
#[\\Deprecated]attribute has been added, allowing library developers to explicitly mark deprecated methods, and IDEs to highlight them.
What Does This Mean for Developers?
Upgrading to PHP 8.4 is not just a checkbox on a to-do list. New property hooks will allow you to write less boilerplate, and improved performance will enable you to save on server resources. This is especially relevant for high-load projects and APIs.
However, as always, before updating on production servers, it is recommended to thoroughly test the compatibility of third-party libraries. Most popular frameworks (Laravel, Symfony) have already released patches to support the innovations.
Stay tuned for updates on PythonLib — we will continue to publish detailed