DEV Community

Devops Makeit-run
Devops Makeit-run

Posted on • Originally published at make-it.run

What's New in PHP 8.4 Features Performance and Upgrade Advice

What’s New in PHP 8.4: Features, Performance & Migration Advice

PHP continues to rapidly evolve. As of 2025, the latest stable release is PHP 8.4 (released Nov 21, 2024), with PHP 8.5 slated for November 2025. Each annual release adds new language features, optimizations, and some deprecations, making it crucial for development teams to stay updated and plan migration carefully (Zend).

  • PHP 8.4 - Property Hooks - Asymmetric Visibility - Array Utilities - JIT Compiler - HTML5 DOM

    Key Features in PHP 8.4

    • Property Hooks: Classes can define custom logic for property get/set, reducing boilerplate.
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); 
       }
  }
}
Enter fullscreen mode Exit fullscreen mode
  • Asymmetric Visibility: Allows different visibility for reading and writing properties. For example: public private(set) int $count; enables public reading but only internal writing.
  • New Array Functions: array_find(), array_find_key(), array_any(), and array_all() functions simplify searching and filtering arrays.
$result = array_find($list, fn($v) => $v > 10); // Returns the first >10 value
Enter fullscreen mode Exit fullscreen mode
  • Parentheses Omission on new: You can now instantiate and chain methods without wrapping parentheses.
$request = new Request()->withMethod('GET')->withUri('/hello-world');
Enter fullscreen mode Exit fullscreen mode
  • Improved JIT: The Just-In-Time compiler has been refactored for maintainability and sets the stage for future performance improvements.
  • HTML5 DOM Support: The DOM extension now natively understands HTML5 tags and semantics.

💡 Tip: Use the new #[Deprecated] attribute for marking functions or classes as deprecated, replacing fragile docblocks.

How 8.4 Compares to Earlier 8.x Releases

  • PHP 8.3 - PHP 8.2 - PHP 8.1 - PHP 8.0
    • 8.3: Brought Typed Class Constants, json_validate(), multibyte-aware string padding, and the #[\Override] attribute. Focused more on polish and consistency (Zend 8.3 Features).
    • 8.2: Introduced Readonly Classes, Disjunctive Normal Form (DNF) types, trait constants, and started deprecating dynamic properties.
    • 8.1: Landmark features included Enumerations, Fibers (async coroutines), intersection types, the never return type, and readonly properties.
    • 8.0: Union types, attributes (metadata), the match expression, nullsafe operator, and the initial JIT implementation.

Performance Analysis

  • Real-world benchmarks (by Kinsta) show PHP 8.3 as the fastest version, but differences between 8.2, 8.3, and 8.4 are modest for most workloads (Kinsta Benchmark).
  • Large CMSs and frameworks like WordPress, Laravel, and Symfony see best performance gains when moving from PHP 7.4 to 8.x.
  • The JIT compiler especially helps in CPU-intensive scenarios, but is not a universal speed boost for typical web apps.

    • 7–13% - WordPress speedup (8.2→8.3) - 51% - Laravel req/sec increase (8.1→8.3) - 27% - Symfony gain (8.1→8.3) - Up to 52% - Overall tested boost (8.3)

💡 Tip: Not every upgrade yields visible speedups. Performance is typically "steady" between recent versions. Optimize code and caching for the biggest wins.

Pros & Cons of Upgrading

  • Type Safety - Performance - Security - Deprecations Pros:
    • Strong typing and modern syntax for more robust code
    • New language features speed development and reduce boilerplate
    • Excellent real-world performance
    • Improved long-term security and longer support lifecycle

Cons:

  • Migration required if you rely on deprecated/removed features
  • Some new features (e.g., property hooks) add complexity
  • Upgrading may require updating libraries and frameworks
  • Not all workloads see notable speed improvements

💡 Tip: Always test your app on the new PHP version and review deprecations before going live.

Summary / Advice

PHP 8.4 and the entire 8.x series represent a modern, high-performance language platform that retains PHP’s ease of use. The advantages—younger language model, better safety, improved toolset, and competitive performance—make upgrading worthwhile for almost all teams. As a best practice: “Always use the latest PHP version for optimized performance and security.”

Further Reading

Top comments (0)