8.1.34

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

Software PHP
Branch 8.1
Status
End of life
End of bug fixes October 25, 2023
End of security fixes December 31, 2025
First official release version 8.1.0
First official release date 4 years ago (November 25, 2021)
Release notes https://www.php.net/ChangeLog-8.php#8.1.34
Documentation https://www.php.net/manual/en/
Download https://www.php.net/releases/8.1.34
PHP 8.1 Releases View full list

What is New in PHP 8.1

PHP 8.1 adds powerful modern features that improve code readability, type safety, and performance. Major highlights include native enumerations, readonly properties, fibers for concurrency, the never return type, intersection types, and many syntax improvements that make development easier and more reliable.

Key New Features

Enumerations (Enums)

Enums provide a clean way to define a set of named values with built-in type safety.

enum Suit {
    case Hearts;
    case Diamonds;
    case Clubs;
    case Spades;
}

function describe(Suit $suit): string { ... }
Readonly Properties

Properties declared as readonly can be written only once, usually in the constructor, making objects truly immutable after creation.

class Post {
    public readonly string $title;
    public readonly int $id;

    public function __construct(string $title, int $id) {
        $this->title = $title;
        $this->id = $id;
    }
}
First-Class Callable Syntax

A simpler way to create callables from functions or methods using the ... syntax.

$callable = strlen(...);
$method = $object->method(...);
New in Initializers

Objects and complex expressions can now be used in default values for parameters, properties, and constants.

function test(array $data = new ArrayObject()) { ... }
Pure Intersection Types

Combine multiple types that a value must satisfy using &.

function iterate(Traversable & Countable $items) { ... }
Never Return Type

Indicates a function never returns normally (it exits or throws).

function redirect(string $url): never {
    header("Location: $url");
    exit;
}
Final Class Constants

Class constants can be marked final to prevent overriding in child classes.

class ParentClass {
    final public const VALUE = "fixed";
}
Fibers

Fibers introduce lightweight cooperative concurrency, allowing code to be paused and resumed.

They help implement advanced async patterns without complex callbacks.

Array Unpacking with String Keys

The spread operator now works with arrays that have string keys.

$array = ['a' => 1, ...$anotherArray];
Explicit Octal Notation

Octal numbers now require the 0o prefix for clarity.

$value = 0o77; // equals 63

New Functions and Features

Area New Items
Core array_is_list() - checks if an array is a sequential list
File System fsync(), fdatasync()
Attributes #[ReturnTypeWillChange] attribute
Sodium XChaCha20 encryption functions

Backward Incompatible Changes

  • Passing null to non-nullable internal parameters is now restricted.
  • The Serializable interface is deprecated.
  • Many resources are converted to object types (e.g., FTP\Connection, LDAP\Connection, PgSql\Connection).
  • HTML entity functions handle single quotes by default.
  • Restrictions on accessing $GLOBALS in certain contexts.
  • MySQLi default error mode changed to exceptions.
  • Implicit incompatible internal function argument types are deprecated.

Performance Improvements

PHP 8.1 includes significant optimizations across the engine:

  • Inheritance cache to reduce class linking overhead.
  • Faster class name resolution.
  • Improved JIT support, including ARM64 backend.
  • Optimizations in ext/date, SPL iterators, serialize/unserialize, and many internal functions.
  • Benchmarks show notable speed gains in real-world applications like Symfony and WordPress.

Releases In Branch 8.1

Version Release date
8.1.34 25 days ago
(December 18, 2025)
8.1.33 6 months ago
(July 03, 2025)
8.1.32 9 months ago
(March 13, 2025)
8.1.31 1 year ago
(November 21, 2024)
8.1.30 1 year ago
(September 26, 2024)
8.1.29 1 year ago
(June 06, 2024)
8.1.28 1 year ago
(April 11, 2024)
8.1.27 2 years ago
(December 21, 2023)
8.1.26 2 years ago
(November 23, 2023)
8.1.25 2 years ago
(October 26, 2023)
8.1.24 2 years ago
(September 28, 2023)
8.1.23 2 years ago
(August 31, 2023)
8.1.22 2 years ago
(August 03, 2023)
8.1.21 2 years ago
(July 06, 2023)
8.1.20 2 years ago
(June 08, 2023)
8.1.19 2 years ago
(May 11, 2023)
8.1.18 2 years ago
(April 13, 2023)
8.1.17 2 years ago
(March 16, 2023)
8.1.16 2 years ago
(February 14, 2023)
8.1.15 2 years ago
(February 02, 2023)
8.1.14 3 years ago
(January 05, 2023)
8.1.13 3 years ago
(November 24, 2022)
8.1.12 3 years ago
(October 27, 2022)
8.1.11 3 years ago
(September 29, 2022)
8.1.10 3 years ago
(September 01, 2022)
8.1.9 3 years ago
(August 04, 2022)
8.1.8 3 years ago
(July 07, 2022)
8.1.7 3 years ago
(June 09, 2022)
8.1.6 3 years ago
(May 12, 2022)
8.1.5 3 years ago
(April 14, 2022)
8.1.4 3 years ago
(March 17, 2022)
8.1.3 3 years ago
(February 17, 2022)
8.1.2 3 years ago
(January 20, 2022)
8.1.1 4 years ago
(December 16, 2021)
8.1.0 4 years ago
(November 25, 2021)