8.4.16

Latest release in branch 8.4
Released 25 days ago (December 18, 2025)

Software PHP
Branch 8.4
Status
Supported
End of bug fixes December 31, 2026
End of security fixes December 31, 2028
First official release version 8.4.1
First official release date 1 year ago (November 21, 2024)
Release notes https://www.php.net/ChangeLog-8.php#8.4.16
Documentation https://www.php.net/manual/en/
Download https://www.php.net/releases/8.4.16
PHP 8.4 Releases View full list

What is New in PHP 8.4

PHP 8.4 brings exciting updates to enhance developer productivity and performance. It introduces powerful features like property hooks, new DOM improvements, and array functions, alongside performance tweaks and bug fixes. This version also includes new tools for better code safety and flexibility, making it a valuable upgrade for web projects.

Property Hooks

Property hooks allow developers to define custom logic when getting or setting property values. This reduces boilerplate code by replacing traditional getters and setters with inline hooks.

class User {
    private string $name;

    public string $displayName {
        get => strtoupper($this->name);
        set => $this->name = strtolower($value);
    }
}

These hooks support both simple and complex operations, improving object-oriented design.

New DOM Enhancements

The DOM extension now supports HTML5 with a new Dom\HTMLDocument class, built on the Lexbor library. This offers better parsing and compliance with modern standards, while keeping the old DOMDocument for compatibility.

$doc = Dom\HTMLDocument::createFromString('<!DOCTYPE html><html><body>Hello</body></html>');
echo $doc->documentElement->tagName; // Outputs: html

This update fixes long-standing issues and adds convenient methods for handling HTML documents.

Array Functions

New array utilities simplify common tasks. Functions like array_find, array_find_key, array_any, and array_all help search and evaluate array elements efficiently.

$numbers = [1, 2, 3, 4];
$result = array_find($numbers, fn($value) => $value > 2);
echo $result; // Outputs: 3

These tools make array handling more intuitive and powerful.

Class Instantiation Improvements

You can now chain methods or access properties directly after creating an object without extra parentheses, reducing syntax clutter.

$class = new ReflectionClass(User::class)->getName();
echo $class; // Outputs: User

This change enhances readability, especially in complex method chains.

Asymmetric Visibility

Properties can now have different visibility for reading and writing, offering more control over access levels.

class Example {
    public read private write string $data;
}

This feature supports advanced encapsulation strategies.

Additional Features

  • mb_trim, mb_ltrim, and mb_rtrim for multi-byte string trimming.
  • bcdivmod in BCMath for division and modulus in one call.
  • CURL_HTTP_VERSION_3 and CURL_HTTP_VERSION_3ONLY for HTTP/3 support.
  • #[\Deprecated] attribute to mark outdated code.
  • New DateTime methods like createFromTimestamp for easier time handling.

Deprecations and Changes

Some features are marked for removal in future versions:

Deprecated Feature Details
Implicit nullable types Requires explicit ?type syntax, e.g., ?string $value = null.
GET/POST session tracking Disabled by default; use cookies instead.

Performance and Bug Fixes

PHP 8.4 includes optimizations in the JIT compiler and fixes for memory leaks and security issues. These improvements ensure better stability and speed for web applications.

Why Upgrade to PHP 8.4

With its new tools and enhancements, PHP 8.4 offers a modern approach to web development. It provides better performance, cleaner code, and robust features, making it a smart choice for developers building secure and efficient websites.

Releases In Branch 8.4

Version Release date
8.4.16 25 days ago
(December 18, 2025)
8.4.15 1 month ago
(November 20, 2025)
8.4.14 2 months ago
(October 23, 2025)
8.4.13 3 months ago
(September 25, 2025)
8.4.12 4 months ago
(August 28, 2025)
8.4.11 5 months ago
(July 31, 2025)
8.4.10 6 months ago
(July 03, 2025)
8.4.8 7 months ago
(June 05, 2025)
8.4.7 8 months ago
(May 08, 2025)
8.4.6 9 months ago
(April 10, 2025)
8.4.5 9 months ago
(March 13, 2025)
8.4.4 10 months ago
(February 13, 2025)
8.4.3 11 months ago
(January 16, 2025)
8.4.2 1 year ago
(December 19, 2024)
8.4.1 1 year ago
(November 21, 2024)