Latest in branch 8.1
8.1.34
Released 18 Dec 2025
(5 months ago)
SoftwarePHP
Version8.1
Status
End of life
Initial release8.1.0
25 Nov 2021
(4 years ago)
Latest release8.1.34
18 Dec 2025
(5 months ago)
End of bug fixes25 Oct 2023
(Ended 2 years ago)
End of security fixes31 Dec 2025
(Ended 5 months ago)
Release noteshttps://www.php.net/ChangeLog-8.php#8.1.34
Source codehttps://github.com/php/php-src/tree/php-8.1.34
Documentationhttps://www.php.net/manual/en/
Downloadhttps://www.php.net/releases/8.1.34
PHP 8.1 ReleasesView 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

VersionRelease date
8.1.3418 Dec 2025
(5 months ago)
8.1.3303 Jul 2025
(11 months ago)
8.1.3213 Mar 2025
(1 year ago)
8.1.3121 Nov 2024
(1 year ago)
8.1.3026 Sep 2024
(1 year ago)
8.1.2906 Jun 2024
(2 years ago)
8.1.2811 Apr 2024
(2 years ago)
8.1.2721 Dec 2023
(2 years ago)
8.1.2623 Nov 2023
(2 years ago)
8.1.2526 Oct 2023
(2 years ago)
8.1.2428 Sep 2023
(2 years ago)
8.1.2331 Aug 2023
(2 years ago)
8.1.2203 Aug 2023
(2 years ago)
8.1.2106 Jul 2023
(2 years ago)
8.1.2008 Jun 2023
(3 years ago)
8.1.1911 May 2023
(3 years ago)
8.1.1813 Apr 2023
(3 years ago)
8.1.1716 Mar 2023
(3 years ago)
8.1.1614 Feb 2023
(3 years ago)
8.1.1502 Feb 2023
(3 years ago)
8.1.1405 Jan 2023
(3 years ago)
8.1.1324 Nov 2022
(3 years ago)
8.1.1227 Oct 2022
(3 years ago)
8.1.1129 Sep 2022
(3 years ago)
8.1.1001 Sep 2022
(3 years ago)
8.1.904 Aug 2022
(3 years ago)
8.1.807 Jul 2022
(3 years ago)
8.1.709 Jun 2022
(4 years ago)
8.1.612 May 2022
(4 years ago)
8.1.514 Apr 2022
(4 years ago)
8.1.417 Mar 2022
(4 years ago)
8.1.317 Feb 2022
(4 years ago)
8.1.220 Jan 2022
(4 years ago)
8.1.116 Dec 2021
(4 years ago)
8.1.025 Nov 2021
(4 years ago)