On November 21, 2024, the PHP development team officially released PHP 8.4. This is another major update that includes new features aimed at modernizing the language and making it more efficient for developers. And while some of the new features are not exactly compatible with previous versions, the release still does a lot to simplify and improve the code creation process
Here are the key innovations that PHP 8.4 offers:
- Property hooks: Developers can now use property hooks to support computed properties natively, improving compatibility with IDEs and static analysis tools. This feature eliminates the need for complex getters/setters and simplifies pre- and post-processing of values.
- Asymmetric Visibility: A new feature allows independent control over write and read access to properties, while reducing the amount of unnecessary code needed to create getters and preserving encapsulation.
- Attribute #[\Deprecated]: The deprecation mechanism is extended for custom functions, methods, and constants, which improves code support and understandability.
- Improved DOM API and HTML5 support: The DOM extension now offers a standardized API for HTML5 documents, fixes compatibility bugs and adds handy features.
- New classes (Dom\HTMLDocument, Dom\XMLDocument) for creating documents are introduced.
- Object API for BCMath: The new BcMath\Number object introduces an object-oriented approach to working with high-precision numbers. It supports standard math operators and provides immutability for improved usability.
- New array_*() functions: PHP 8.4 adds new utility functions for working with arrays.
- Specialized PDO driver subclasses: Developers can now use new PDO subclasses for databases such as MySQL, PostgreSQL, and SQLite, which extends database interoperability.
- Enhanced functionality with new classes and methods: The update includes Lazy Objects, improved JIT implementation, enhanced math functions, new DateTime methods and functions for working with strings and graphemes.
- Improved performance and compatibility: New features for query processing, enhanced reflection capabilities, and additional system features improve performance and compatibility.
- Deprecation and backward compatibility changes: PHP 8.4 gets rid of deprecated features such as implicitly Nullable parameters, defined constants, and some mysqli functions. Also extensions that previously shipped with PHP, such as IMAP and OCI8, are moved to PECL to allow for greater modularity.
This release is a major milestone for PHP, providing tools to modernize projects, streamline workflows, and improve productivity. Asymmetric visibility and property hooks usher in a new era of flexibility and efficiency, while a new DOM API ensures compliance with modern web standards. A detailed list of changes and migration guides, as always, can be found on the official PHP website.
And we are happy to inform you that PHP 8.4 is already available for you on RealHOST and is supported in all Linux shared hosting plans. So, there is a good reason to familiarize yourself with all the features of the release, update your environments and adapt your projects to use the improved capabilities.
As always, we wish you successful work together with RealHOST hosting!