PHP 8.4 is bringing several exciting new features and improvements to the language, aimed at enhancing performance, usability, and security. Here’s a sneak peek at what’s new and exciting in this upcoming release:
🞜 New Array Functions
PHP 8.4 introduces functions like array_find
, array_find_key
, array_any
, and array_all
. These functions help developers search and check arrays more efficiently, reducing the need for repetitive code and making PHP more versatile
🞜 DOM Extension with HTML5 Support
The DOM extension now supports HTML5 parsing and serialization, which simplifies handling HTML5-specific tags and embedded HTML in JavaScript. This is achieved through the new DOM\HTMLDocument
class.
🞜 Improved Password Hashing Security
The default cost for bcrypt has been increased from 10 to 12, enhancing password security by making it more resistant to brute-force attacks.
🞜 New JIT Implementation
PHP 8.4 introduces a new Just-In-Time (JIT) compilation implementation based on the IR framework. This change aims to improve performance by consolidating back-ends and enabling machine-independent optimizations.
🞜 Enhanced XML Parsing
The new XML_OPTION_PARSE_HUGE
option in the ext/xml PHP extension improves the parsing of large XML documents, preventing potential errors and making handling of large documents more reliable.
🞜 Multibyte String Functions
New multibyte functions mb_trim
, mb_ltrim
, and mb_rtrim
have been added, allowing developers to trim strings with multibyte characters more easily and accurately.
🞜 Simplified Class Instantiation Syntax
PHP 8.4 allows accessing class members directly after instantiation without needing extra parentheses, aligning PHP more closely with other languages like Java and C#.
🞜 DateTime from Unix Timestamp
A new method, createFromTimestamp
, makes it easier to create DateTime
objects from Unix timestamps, including those with microseconds.
PHP 8.4 is set to bring numerous improvements that enhance the language’s usability and functionality. From new array find functions to property hooks, streamlined class instantiation, and easier DateTime creation, there’s a lot to look forward to. Staying updated with these new features will help you write better, more efficient code.
Keep an eye out for the official release on November 21, 2024, and start experimenting with the pre-release versions to get a head start.