PHP 8.5: Release Date and Features, April 2025

3 min readApr 24, 2025
PHP 8.5 Features & Release

As of April 2025, PHP 8.5 is in active development, with its release scheduled for November 2025. This upcoming version introduces several enhancements aimed at improving developer experience and language capabilities.

Although not all features are voted or implemented yet, I would like to give an overview to the current situation, as I did last year with PHP 8.4.

Below is an overview of the current implementation state of PHP 8.5 features, categorized into “In Voting,” “Accepted” and “Implemented”.

In Voting

array_first() and array_last()

The RFC proposes two functions providing a simple and readable way to retrieve the first and last elements of an array without affecting its internal pointer.

$items = ['a' => 10, 'b' => 20, 'c' => 30];
echo array_first($items); // 10
echo array_last($items); // 30

never Parameters (v2)

This RFC refines the use of the never return type introduced in PHP 8.1 by applying it to parameters, signaling that a function cannot be passed any arguments that would result in a return.

function terminate(): never {
exit;
}

Accepted

Attributes on Constants

Adds support for applying attributes to constants, including deprecation markers.

#[Deprecated("Use NEW_CONST")]
const OLD_CONST = 123;

Additionally, the RFC taking advantage of this new feature, the #[\Deprecated] attribute is updated to also target compile-time non-class constants.

Grapheme Cluster Support in levenshtein()

Improves accuracy in string comparison by considering Unicode grapheme clusters instead of codepoints.

Implemented

Asymmetric Visibility for Static Properties

The RFC introduces asymmetric visibility for static properties in PHP 8.5, allowing developers to define different access levels for reading and writing. This builds upon the asymmetric visibility introduced for object properties in PHP 8.4 and brings feature parity to static properties.

class Settings {
public private(set) static string $mode = 'live';
}

Marking Return Values as Important with #[\NoDiscard]

Warns if a return value marked with #[\NoDiscard] is unused.

#[\NoDiscard]
function result(): int {
return 42;
}
result(); // invalid

get_error_handler() and get_exception_handler()

This RFC proposes two new functions that allow to query the current error/exception handlers in a more direct way:

function get_error_handler(): ?callable
function get_exception_handler(): ?callable

The functions return the currently defined error and exception handlers, respectively. If no handler is in place, null is returned.

The returned handler is the exact callback value that was passed to set_error_handler() or set_exception_handler() to define it.

set_error_handler('myHandler');
$handler = get_error_handler();

Closures in Constant Expressions

The RFC will allow closures to be used in constant expressions in PHP 8.5, enabling inline functions in default values or class constants. This enhances the expressiveness of the language in functional programming scenarios.

const FILTER = static fn($v) => is_string($v);

First-Class Callables in Constant Expressions

First-class callables will be introduced with this RFC to PHP 8.5, allowing them to appear in constant expressions like class constants or default values. This enables referencing methods and functions as constants, enhancing reusability and clarity in API design.

class Logger {
const HANDLER = self::class . '::log';
}

Persistent cURL Share Handle Improvements

The RFC adds persistent identifiers to PHP 8.5’s cURL share handles, allowing data like DNS cache to persist across script runs. This boosts efficiency for high-frequency HTTP clients.

$handle = curl_share_init('shared_dns');
curl_share_setopt($handle, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS);

Improved Error Backtraces (v2)

This RFC improves stack traces by providing clearer and more consistent formatting, including better handling of call frames and context. Debugging becomes more informative with less guesswork.

Directory Class as Resource Object

The Directory object will be modernized into a final, non-serializable class with restricted dynamic properties. This aligns directory handling with PHP’s type-safety direction.

$dir = dir("/tmp");
echo $dir->path; // Safe, object-style access

Summary

PHP 8.5 introduces targeted improvements for readability, safety, and performance. The changes are largely developer-centric, emphasizing more predictable behavior, modern syntax, and robust error handling. Stay tuned for the full release in November 2025!

PHP 8.5 introduces targeted improvements for readability, safety, and performance. The changes are largely developer-centric, emphasizing more predictable behavior, modern syntax, and robust error handling. Stay tuned for the full release in November 2025!

--

--

Doğan Uçar
Doğan Uçar

Written by Doğan Uçar

Software Engineer, PHP/Laminas (Zend), Backend, Cloud, Freelancer & CEO, Open Source Contributor

Responses (3)