New Release

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)

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

Property Promotion for Final Classes

Property promotion is now available for final class constructors

Attributes for Constants

Constants now support attributes for better metadata

#[\Override] for Properties

Better validation when overriding parent properties

#[\Deprecated] for Traits

Mark legacy code with deprecation attributes

Asymmetric Visibility

Fine-grained control over read/write access for static properties

Handler Introspection

New functions for inspecting registered error handlers

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.

Windows

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

Docker Images

Official PHP 8.5 Docker images for containerized deployments.

Powered by the best PHP frameworks