New Release

PHP 8.5

Refined developer experience with new utility functions, enhanced debugging, and modern syntax improvements

Release Date November 20, 2025
Support Until November 2027
Security Fixes Until November 2028

What's New in PHP 8.5

Major improvements with modern syntax, better APIs, and enhanced developer experience

RFC 3986 and WHATWG URL Compliant API RFC

New URI extension providing standards-compliant URL parsing with modern object-oriented API

PHP < 8.5
$components = parse_url("https://php.net/releases/8.5/en.php"); var_dump($components['host']); // string(7) "php.net"
PHP 8.5
use Uri\Rfc3986\Uri; $uri = new Uri("https://php.net/releases/8.5/en.php"); var_dump($uri->getHost()); // string(7) "php.net"
Clone with v2 RFC

Modify properties while cloning, perfect for readonly properties and immutable objects

PHP < 8.5
final readonly class PhpVersion { public function __construct( public string $version = 'PHP 8.4', ) {} public function withVersion(string $version) { $newObject = clone $this; $newObject->version = $version; return $newObject; } } var_dump(new PhpVersion()->withVersion('PHP 8.5')); // Fatal error: Cannot modify readonly property
PHP 8.5
final readonly class PhpVersion { public function __construct( public string $version = 'PHP 8.4', ) {} public function withVersion(string $version) { return clone($this, ['version' => $version]); } } $version = new PhpVersion(); var_dump( $version->withVersion('PHP 8.5'), $version->version, );
Pipe Operator RFC

Chain function calls naturally with the new pipe operator for cleaner, more readable code

PHP < 8.5
$input = ' Some kind of string. '; $output = strtolower( str_replace(['.', '/', '…'], '', str_replace(' ', '-', trim($input) ) ) );
PHP 8.5
$input = ' Some kind of string. '; $output = $input |> trim(...) |> (fn (string $s) => str_replace(' ', '-', $s)) |> (fn (string $s) => str_replace(['.', '/', '…'], '', $s)) |> strtolower(...);
New #[\NoDiscard] Attribute RFC

Mark functions whose return values should not be ignored

PHP < 8.5
function getPhpVersion(): string { return 'PHP 8.4'; } getPhpVersion(); // No Errors
PHP 8.5
#[\NoDiscard] function getPhpVersion(): string { return 'PHP 8.4'; } getPhpVersion(); // Warning: The return value should be used // or intentionally ignored by casting as (void)
First Class Callables in Constant Expressions RFC RFC

Use closures and first-class callables directly in attributes and constant expressions

PHP < 8.5
final class CalculatorTest extends \PHPUnit\Framework\TestCase { #[DataProvider('subtractionProvider')] public function testSubtraction( int $minuend, int $subtrahend, int $result ): void { $this->assertSame( $result, Calculator::subtract($minuend, $subtrahend) ); } public static function subtractionProvider(): iterable { for ($i = -10; $i <= 10; $i++) { yield [$i, $i, 0]; yield [$i, 0, $i]; yield [0, $i, -$i]; } } }
PHP 8.5
final class CalculatorTest { #[Test\CaseGenerator(static function (): iterable { for ($i = -10; $i <= 10; $i++) { yield [$i, $i, 0]; yield [$i, 0, $i]; yield [0, $i, ($i * -1)]; } })] public function testSubtraction( int $minuend, int $subtrahend, int $result ) { \assert( Calculator::subtract($minuend, $subtrahend) === $result ); } }
Persistent cURL Share Handle Improvement RFC RFC

Simplified API for persistent cURL share handles with automatic management

PHP < 8.5
$sh = curl_share_init(); curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_DNS); curl_share_setopt($sh, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT); $ch1 = curl_init('https://php.net/'); curl_setopt($ch1, CURLOPT_SHARE, $sh); curl_exec($ch1); $ch2 = curl_init('https://thephp.foundation/'); curl_setopt($ch2, CURLOPT_SHARE, $sh); curl_exec($ch2); curl_share_close($sh); curl_close($ch1); curl_close($ch2);
PHP 8.5
$sh = curl_share_init_persistent([ CURL_LOCK_DATA_DNS, CURL_LOCK_DATA_CONNECT ]); $ch1 = curl_init('https://php.net/'); curl_setopt($ch1, CURLOPT_SHARE, $sh); curl_exec($ch1); $ch2 = curl_init('https://thephp.foundation/'); curl_setopt($ch2, CURLOPT_SHARE, $sh); curl_exec($ch2); curl_close($ch1); curl_close($ch2);
New array_first() and array_last() Functions RFC

Convenient functions to retrieve the first and last elements of arrays

PHP < 8.5
$php = [ 'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'], 'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'], 'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'], 'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'], ]; $upcomingRelease = null; foreach ($php as $key => $version) { if ($version['state'] === 'upcoming') { $upcomingRelease = $version; break; } } var_dump($upcomingRelease);
PHP 8.5
$php = [ 'php-82' => ['state' => 'security', 'branch' => 'PHP-8.2'], 'php-83' => ['state' => 'active', 'branch' => 'PHP-8.3'], 'php-84' => ['state' => 'active', 'branch' => 'PHP-8.4'], 'php-85' => ['state' => 'upcoming', 'branch' => 'PHP-8.5'], ]; $upcomingRelease = array_first( array_filter( $php, static fn($version) => $version['state'] === 'upcoming' ) ); var_dump($upcomingRelease);

Additional New Features

More improvements for better developer experience

Property Promotion for Final Classes

Property promotion is now available for final class constructors, making it easier to create immutable data classes.

Attributes for Constants

Constants now support attributes, allowing for better metadata and documentation directly in code.

#[\Override] for Properties

The #[\Override] attribute now works on properties, providing better validation when overriding parent properties.

#[\Deprecated] for Traits

The #[\Deprecated] attribute is now available for traits, helping developers mark legacy code.

Asymmetric Visibility for Static Properties

Static properties now support asymmetric visibility modifiers, allowing fine-grained control over read/write access.

#[\DelayedTargetValidation] Attribute

New #[\DelayedTargetValidation] attribute for improved attribute validation control.

Handler Introspection Functions

New get_error_handler(), get_exception_handler() functions and Closure::getCurrent method for inspecting registered handlers.

DOM Element Methods

New Dom\Element::getElementsByClassName() and Dom\Element::insertAdjacentHTML() methods for better DOM manipulation.

Enchant Dictionary Functions

New enchant_dict_remove_from_session() and enchant_dict_remove() functions for spell-checking functionality.

grapheme_levenshtein()

New grapheme_levenshtein() function for calculating edit distance between strings using grapheme clusters.

OPcache File Cache Check

New opcache_is_script_cached_in_file_cache() function to check if a script is cached in the file-based OPcache.

Reflection Enhancements

New methods: ReflectionConstant::getFileName(), getExtension(), getExtensionName(), getAttributes(), and ReflectionProperty::getMangledName().

cURL Functions

New CurlSharePersistentHandle class and curl_multi_get_handles() function for improved cURL handling.

Deprecations & Breaking Changes

Important changes to be aware of when upgrading

⚠️ Deprecations in PHP 8.5

PHP 8.5 focuses on new features with minimal breaking changes. Review your application for any deprecated features from previous versions that may be removed in future releases.

  • Check the migration guide for detailed information on deprecated features
  • Enable error reporting during testing to catch deprecation notices
  • Plan updates for code using deprecated functionality from PHP 8.4 and earlier

Release Timeline

PHP 8.5 development and support schedule

Nov 2025 GA Release

General Availability

PHP 8.5.0 released with all new features and improvements.

Nov 2027 End of Active Support

Active Support Ends

Bug fixes and general maintenance will cease. Security fixes only.

Nov 2028 End of Life

Security Support Ends

PHP 8.5 reaches end of life. Please upgrade to a newer version.

Migration Guide

Upgrading to PHP 8.5 from earlier versions

🎯 New Features to Explore

  • Start using the pipe operator for cleaner function chaining
  • Replace verbose array access with array_first() and array_last()
  • Leverage the new URI extension for standards-compliant URL parsing
  • Use clone with syntax for immutable object patterns
  • Apply #[\NoDiscard] attribute to critical functions
  • Use first-class callables in attributes for better testing

⚠️ Deprecations

  • Review deprecated features from PHP 8.4 that may be removed
  • Check for warnings in your error logs during testing
  • Plan to update code using deprecated functionality

✅ Testing Your Application

  • Run your test suite with PHP 8.5 in a staging environment
  • Enable error reporting to catch any deprecation notices
  • Update dependencies to versions compatible with PHP 8.5
  • Review release notes for breaking changes

Get PHP 8.5

Download PHP 8.5 for your platform

Source Code

Compile PHP 8.5 from source for maximum flexibility and customization.

Download Source

Windows

Pre-built binaries for Windows, including thread-safe and non-thread-safe versions.

Download for Windows

Docker Images

Official PHP 8.5 Docker images for containerized deployments.

View on Docker Hub