# What's New in PHP 8.4 (2024): Features, Changes, Performance & Upgrade Advice
- PHP 8.4 - Performance - Property Hooks - Asymmetric Visibility - JIT - HTML5 DOM - Array Utilities - Deprecations > 💡 **Tip:** Always test your application in a staging environment before upgrading to a new PHP version to spot and fix deprecations and breaking changes. <ListHeading> Key Features in PHP 8.4 </ListHeading> **Highlights:** - Property Hooks for powerful virtual properties with get/set logic. - Asymmetric Visibility: different read/write access for properties. - `array_find`, `array_find_key`, `array_any`, and `array_all` functions. - Omit parentheses on `new` class instantiation syntax. - Huge improvement: DOM extension now supports modern HTML5. ## Example: Property Hooks ```php class User {
public function __construct(private string $first, private string $last) {}
public string $fullName {
get => $this->first . " " . $this->last;
set { [$this->first, $this->last] = explode(' ', $value, 2); }
}
}
PHP 8.4 lets you define get/set hooks for properties, ditching lots of manual boilerplate ([Zend PHP 8.4 release](https://www.zend.com/blog/php-8-4#:~:text=PHP%208)). <Blockquote content="With this release including several exciting new features and a few key deprecations… teams will need to assess how the changes in PHP 8.4 impact their applications." author={{ name: 'Zend Team', role: 'Official PHP Release Notes' }} /> <ListHeading> Improvements over PHP 8.3, 8.2, 8.1, and 8.0 </ListHeading> - Typed Constants (8.3) - Readonly Classes (8.2) - Enums (8.1) - Union Types (8.0) - 8.3 focused on polishing features, added typed class constants, and new JSON validation utilities ([Zend 8.3 features](https://www.zend.com/blog/php-8-3#:~:text=json_validate)). - 8.2 introduced readonly classes and stricter property rules ([Laravel News 8.2](https://laravel-news.com/php-8-2-0#:~:text=Readonly%20classes)). - 8.1 brought major upgrades like Enums and Fibers ([Phoronix 8.1](https://www.phoronix.com/news/PHP-8.1-Released#:~:text=PHP%208,1%20also%20brings)). - 8.0 was the leap to union types, match expressions, and the first version of JIT ([InfoWorld PHP 8.0](https://www.infoworld.com/article/2261427/php-80-arrives-with-union-types-jit-compilation.html#:~:text=PHP%208,Time%20compilation)). <ListHeading> Performance Benchmarks </ListHeading> <StatListItem value="52% faster" label="Kinsta (8.3 vs 8.1)" /> <StatListItem value="7-13% gain" label="WordPress 8.3 vs 8.2" /> <StatListItem value="Steady" label="8.4 vs 8.3/8.2 (Tideways)" /> - PHP 8.4 keeps performance on par with the best results in the PHP 8.x series. - Upgrading from 7.4 or earlier gives a noticeable speed boost for most CMSs & frameworks ([Kinsta benchmarks](https://kinsta.com/blog/php-benchmarks/#:~:text=was%20proven%20the%20fastest%20tested,the%20tested%20CMSs%20and%20frameworks)). - Between 8.2–8.4, changes are modest for many web apps ([Tideways 8.4 analysis](https://tideways.com/profiler/blog/php-benchmarks-8-4-performance-is-steady-compared-to-8-3-and-8-2#:~:text=Our%20tests%20show%20that%2C%20in,Symfony%20and%20WordPress%20demo%20application)). > 💡 **Tip:** Upgrade won’t fix performance alone—optimize code and use OPcache for best results! <ListHeading> Pros & Cons </ListHeading> **Pros** - Modern OO syntax - Better type system - Cleaner APIs - Incremental speed gains - Improved security - Longer support **Cons** - Potential refactor work - Deprecations & incompatibilities - Complex new features - Third-party ecosystem lag <Blockquote content="Upgrading to the latest PHP version is not a magic pill to improve performance." author={{ name: 'Tideways Benchmark Team', role: 'PHP Performance Analysts' }} /> ## Summary > 💡 **Tip:** Use the latest PHP for security and support—but always test and fix code for backwards compatibility before rolling out in production. <TimelineBlock> PHP 8.4 released Nov 21, 2024. PHP 8.5 expected November 2025. </TimelineBlock> <ListHeading> Reference Links </ListHeading> - [Zend PHP 8.4 Release](https://www.zend.com/blog/php-8-4#:~:text=PHP%208) - [Kinsta 2024 PHP Benchmarks](https://kinsta.com/blog/php-benchmarks/#:~:text=was%20proven%20the%20fastest%20tested,the%20tested%20CMSs%20and%20frameworks) - [Tideways PHP 8.4 Performance](https://tideways.com/profiler/blog/php-benchmarks-8-4-performance-is-steady-compared-to-8-3-and-8-2#:~:text=Our%20tests%20show%20that%2C%20in,Symfony%20and%20WordPress%20demo%20application) - [What's New in PHP 8.3](https://www.zend.com/blog/php-8-3#:~:text=json_validate) - [PHP 8.2 Readonly Classes](https://laravel-news.com/php-8-2-0#:~:text=Readonly%20classes) - [PHP 8.1 Major Release](https://www.phoronix.com/news/PHP-8.1-Released#:~:text=PHP%208,1%20also%20brings) - [PHP 8.0 Big Features](https://www.infoworld.com/article/2261427/php-80-arrives-with-union-types-jit-compilation.html#:~:text=PHP%208,Time%20compilation) </Typography></FadeIn>
Top comments (0)