PHP 8.4: Complete Guide to Release Date and Features

PHP 8.4 was released on November 21, 2024. This post is the complete overview of everything that changed - from new language syntax and array functions to deprecations and security improvements. Whether you are planning an upgrade or evaluating what 8.4 means for your codebase, this covers it all.
Release Timeline
| Date | Release |
|---|---|
| Jun 06 2024 | Alpha 1 |
| Jun 20 2024 | Alpha 2 |
| Jul 04 2024 | Alpha 3 |
| Jul 16 2024 | Feature freeze |
| Jul 18 2024 | Beta 1 |
| Aug 01 2024 | Beta 2 |
| Aug 15 2024 | Beta 3 |
| Aug 29 2024 | RC 1 |
| Sep 12 2024 | RC 2 |
| Sep 26 2024 | RC 3 |
| Oct 10 2024 | RC 4 |
| Oct 24 2024 | RC 5 |
| Nov 07 2024 | RC 6 |
| Nov 21 2024 | GA |
New Array Functions
PHP 8.4 adds four long-overdue array functions that replace verbose array_filter + reset patterns:
array_find($array, $callback): mixed- returns the first element for which$callbackreturnstrue.array_find_key($array, $callback): mixed- returns the key of the first matching element.array_any($array, $callback): bool- returnstrueif$callbackreturnstruefor any element.array_all($array, $callback): bool- returnstrueif$callbackreturnstruefor all elements.
Read more about the RFC here.
Instantiation and Method Call in One Line
Syntactical sugar, but a good one. Instead of wrapping in parentheses:
<?php
(new MyClass())->myMethod();
You can now write:
<?php
new MyClass()->myMethod();
The RFC covers not just methods but also constants, static members, and properties. A small but welcome readability improvement.
Property Hooks
One of the headline features of PHP 8.4. Property hooks allow you to attach get and set logic directly to a property declaration, reducing boilerplate for backed properties. I wrote a detailed analysis of property hooks - including where they shine and where they introduce complexity - in a dedicated post.
#[Deprecated] Attribute
PHP 8.4 introduces a standardized #[Deprecated] attribute so framework and library authors can mark code as deprecated in a way the engine understands - triggering proper deprecation notices, just like internal PHP deprecations do.
<?php
#[\Deprecated("use Baz instead", since: "5.9")]
class FooBar {
}
Previously, userland code had no standardized way to signal deprecation - authors resorted to docblock annotations or manual trigger_error() calls. This closes that gap. I have mixed feelings about over-using attributes for configuration, but #[Deprecated] is exactly the right use case for them.
Increased Bcrypt Cost
The default bcrypt cost parameter for password_hash() increases from 10 to 12 in PHP 8.4. This makes hashing slightly slower but significantly more resistant to brute-force attacks as hardware gets faster. If you have performance-sensitive code that depends on the default cost, you may want to set it explicitly.
New Rounding Modes in round()
PHP 8.4 adds four new rounding mode constants: PHP_ROUND_CEILING, PHP_ROUND_FLOOR, PHP_ROUND_AWAY_FROM_ZERO, and PHP_ROUND_TOWARD_ZERO. These give developers precise control over numerical rounding - particularly useful for financial calculations.
Enhanced XML Document Parsing
A new parser option XML_OPTION_PARSE_HUGE addresses a long-standing limitation where large XML documents would fail to parse reliably. Applications handling large data feeds or document imports will benefit directly.
HTML5 Document Parsing
PHP 8.4 introduces the DOM\HTMLDocument class for parsing and serializing HTML5 documents. The existing DOMDocument was built for HTML4 and handled modern HTML5 with a number of quirks. This brings PHP's DOM handling in line with modern web standards.
New JIT IR Framework
The JIT compiler gets a new implementation based on an Independent IR (Intermediate Representation) Framework. This consolidates the various JIT backends, enables machine-independent optimizations, and opens the door for future performance improvements and external compiler contributions. For most applications the difference is not immediately visible, but it is a significant internal investment.
DateTime Improvements
createFromTimestamp: DateTime and DateTimeImmutable now have a static createFromTimestamp() factory method. Before 8.4:
<?php
$dt = new DateTimeImmutable();
$dt = $dt->setTimestamp(1718337072);
With 8.4:
<?php
$dt = DateTimeImmutable::createFromTimestamp(1718337072);
getMicrosecond / setMicrosecond: Both DateTime and DateTimeImmutable gain getMicrosecond() and setMicrosecond() methods for high-resolution time handling - useful for logging, financial applications, and anything requiring sub-millisecond precision.
Multibyte String Functions
Three new functions in the mbstring extension for multibyte-safe string trimming:
mb_trim()- trims from both ends.mb_ltrim()- trims from the start.mb_rtrim()- trims from the end.
Previously trim() was not safe for multibyte encodings. Essential for applications handling non-ASCII languages.
HTTP Handling: New Functions
Two new functions replace the magic $http_response_header variable:
http_get_last_response_headers()- retrieves headers from the last HTTP response received.http_clear_last_response_headers()- clears those headers.
The old $http_response_header was a locally-scoped magic variable that IDEs and static analyzers struggled with. These new functions are explicit, discoverable, and properly supported by tooling.
New request_parse_body() Function
PHP has always parsed multipart/form-data for POST requests into $_POST and $_FILES, but not for other HTTP verbs like PUT or PATCH. The new request_parse_body() function exposes this parsing for any HTTP verb - a change that is primarily relevant for REST API and framework developers.
Implicit Nullable Parameter Deprecation
PHP 8.4 deprecates implicitly nullable parameter declarations. This pattern was silently allowed before:
<?php
function doStuff(string $test = null) {}
The correct, explicit form (compatible with PHP 7.1+) is:
<?php
function doStuff(?string $test = null) {}
This is a PHP 9.0 forward-compatibility change. Run static analysis now to find affected code before it becomes an error.
Deprecations: oci8 and IMAP
The oci8, pdo_oci (Oracle), and IMAP extensions have been moved out of the PHP core to PECL. The IMAP C library has not been maintained since 2018. Both extensions are still installable via PECL but are no longer shipped with PHP. If your application depends on either, plan a migration path.
Conclusion
PHP 8.4 is a solid release. The new array functions alone will clean up a lot of common patterns, and the new ClassName()->method() syntax removes a persistent annoyance. The deprecation of implicit nullables is the most important compatibility item to address if you are upgrading from 8.3. Property hooks are the headline feature - divisive, but worth understanding regardless of whether you adopt them.
If you are planning an upgrade or have questions about your specific codebase, get in touch.