PHP 8.4 Features What’s New and What Developers Need to Know

Content

As we approach the final quarter of 2025, the release of PHP 8.4 has generated a lot of buzz among web developers, backend engineers, and software architects. Staying updated with the latest PHP version is crucial for maintaining performance, security, and compatibility in modern applications. PHP 8.4 continues to build upon the innovations of PHP 8.x, offering a mix of powerful enhancements, deprecations, and quality-of-life improvements.

 

In this article, we’ll break down the most exciting PHP 8.4 features, how they affect real-world development, and what developers need to consider when upgrading.

1. Readonly Classes

Building upon the existing readonly properties from PHP 8.1, PHP 8.4 introduces readonly classes, allowing developers to define a class in which all properties are automatically readonly. This feature simplifies the creation of immutable objects and ensures better data integrity across your application.

				
					Example:

php

CopyEdit

readonly class Product {

public function __construct(

public string $name,

public float $price

) {}

}
				
			

No property in this class can be modified after initialization, making it ideal for value objects and configuration entities.

2. Just-In-Time (JIT) Compilation Improvements

While JIT was first introduced in PHP 8.0, PHP 8.4 brings performance refinements that make JIT more efficient for real-world applications. The new version reduces memory overhead and improves execution time for CPU-intensive operations like image processing, data transformation, and cryptographic functions.

 

Although JIT still doesn’t impact typical web applications drastically, the improvements will be noticeable in specific computational use cases.

3. Enhanced Type Safety and Strictness

PHP 8.4 continues the move towards more strict typing. This version tightens several inconsistencies around type coercion, especially in functions and internal APIs. Functions are less tolerant of loose typing, encouraging cleaner, safer, and more predictable code.

 

Notable change: Passing null to non-nullable parameters will now throw a TypeError in more situations than

before.

4. Deprecation of Dynamic Properties (Final Phase)

Dynamic properties (i.e., properties added at runtime to class objects) are now fully deprecated in PHP 8.4. Attempting to use them will result in a fatal error unless the class implements the __get() and __set() magic methods or uses #[AllowDynamicProperties].

 

This change forces developers to declare all class properties explicitly, improving IDE support, readability, and debugging.

5. Improved Password Hashing API

Security gets a boost in PHP 8.4 with an updated password hashing API. The password_hash() and password_verify() functions now support new algorithms, including Argon2id updates and future-proofing for post-quantum cryptography standards.

 

New Constants Added:

6. Array Unpacking with String Keys

Until now, array unpacking (using …) only worked with arrays having integer keys. PHP 8.4 adds support for string keys, making array merging more versatile and reducing the need for array_merge().

				
					Example:

php

CopyEdit

$arr1 = ['name' => 'PHP'];

$arr2 = ['version' => '8.4'];


$result = [...$arr1, ...$arr2];
				
			

7. New Built-in Functions and Utilities

PHP 8.4 introduces several new built-in functions aimed at improving developer productivity:

These micro-improvements add up to a smoother and more expressive developer experience.

8. Changes to foreach by Reference

PHP 8.4 introduces stricter validation when using foreach with references. If you use foreach by reference with temporary arrays, PHP will now emit a warning.

				
					Example:

php

CopyEdit

foreach ([1, 2, 3] as &$value) {

// Warning in PHP 8.4

}
				
			

This encourages safer reference handling and prevents unexpected behavior during iteration.

9. Deprecated Features You Should Know

To prepare for PHP 9.0, several features are now deprecated in PHP 8.4:

Review your codebase for deprecated features to ensure future compatibility.

10. What Developers Should Do Now

If you are currently running PHP 8.1 or 8.2, upgrading to PHP 8.4 should be relatively smooth, especially if you’ve already adopted stricter typing and declared properties explicitly.

 

Here’s a quick checklist:

Frameworks like Laravel and Symfony are expected to support PHP 8.4 out of the box within weeks of its release.

FAQs About PHP 8.4

Mostly, yes. However, some deprecated features have been removed or now throw errors. It’s important to test thoroughly before upgrading.

The introduction of readonly classes is one of the most significant changes, offering better

support for immutable design patterns.

Yes, especially in CPU-heavy operations, thanks to JIT enhancements. However, for standard web apps, the performance gain is modest.

You don’t need to, but you can now choose newer, more secure algorithms through updated constants.

Use static code analyzers like PHPStan or run your test suite in a PHP 8.4 environment to identify any breaking changes or deprecations.