PHP 8.5 was officially released on November 20, 2025 as the latest major update to the PHP language. This release introduces several new features including the Pipe operator, a new URI extension, improved object cloning capabilities, and multiple developer-experience improvements. ()
PHP 8.5 continues the modernization of the language by improving readability, debugging capabilities, and internal consistency while maintaining compatibility with most PHP 8.4 applications.
This article covers the major new features, improvements, and deprecations in PHP 8.5.
Major New Features in PHP 8.5
Pipe Operator
One of the headline features of PHP 8.5 is the pipe operator (|>), which allows developers to chain function calls from left to right. ()
Traditionally, nested function calls could make code harder to read.
Before
$result = strtoupper(trim(str_replace('world', 'PHP', $text)));PHP 8.5
$result = $text
|> str_replace('world', 'PHP', $$)
|> trim($$)
|> strtoupper($$);The pipe operator passes the result of each expression to the next one, improving readability and making code easier to follow.
URI Extension
PHP 8.5 introduces a native URI extension designed to handle modern URL parsing more reliably. ()
The traditional parse_url() function has long struggled with malformed URLs and modern web standards. The new extension provides classes that support RFC 3986 and WHATWG URL parsing standards.
Example:
$uri = new Uri\Rfc3986\Uri("https://example.com/path");
echo $uri->getScheme(); // https
echo $uri->getHost(); // example.com
echo $uri->getPath(); // /pathThis provides safer and more consistent URL handling for modern web applications.
Clone With (Modify Properties While Cloning)
PHP 8.5 introduces support for modifying properties during cloning, sometimes referred to as Clone With. ()
This makes it easier to work with immutable objects and the “with-er” pattern.
Example:
$newUser = clone($user, [
'name' => 'John Doe'
]);Instead of cloning and then modifying the object separately, developers can create a modified copy in a single step.
Closures in Constant Expressions
PHP 8.5 now allows closures and first-class callables inside constant expressions. ()
This means closures can now be used in places such as:
attribute parameters
default property values
default function parameters
constants and class constants
This expands the flexibility of PHP’s type system and improves metaprogramming capabilities.
New Array Helper Functions
Two small but useful functions were added to the standard library:
array_first()
array_last()Example:
$array = [10, 20, 30];
echo array_first($array); // 10
echo array_last($array); // 30These functions simplify retrieving the first and last elements of arrays without needing array_key_first() or array_key_last(). ()
Better Debugging With Fatal Error Stack Traces
PHP 8.5 now includes stack traces for fatal errors, making debugging significantly easier. ()
Previously fatal errors only displayed the error message and line number. Developers can now see the full call stack leading to the crash.
New Debugging and Utility Functions
Several new functions and CLI tools were introduced to improve debugging and framework development.
New Functions
get_error_handler()
get_exception_handler()These functions allow developers to retrieve the currently active handlers, which is especially useful for frameworks and debugging tools. ()
New CLI Option
php --ini=diffThis command shows configuration settings that differ from default values, making server configuration debugging easier. ()
Deprecations in PHP 8.5
Several older behaviors and functions were deprecated to simplify the language.
Deprecated Non-Canonical Type Casts
The following type casts are now deprecated:
(boolean)
(integer)
(double)
(binary)Developers should instead use the canonical versions:
(bool)
(int)
(float)
(string)Deprecated Functions
Some legacy functions were deprecated because they no longer perform meaningful operations:
curl_close()
curl_share_close()
xml_parser_free()These functions became no-ops in earlier PHP versions and are now officially deprecated. ()
Another deprecated function:
mysqli_execute()Developers should use:
mysqli_stmt_execute()instead. ()
Removed Features
Some previously deprecated functionality has been removed.
One notable removal is the CLI/CGI -z or --zend-extension option, which is no longer supported. ()
Other Improvements
Additional improvements introduced in PHP 8.5 include:
new
IntlListFormatterclassnew
locale_is_right_to_left()functionnew
curl_multi_get_handles()functionnew constants such as
PHP_BUILD_PROVIDERandPHP_BUILD_DATEinternal engine and performance improvements ()
Should You Upgrade to PHP 8.5
Most PHP 8.4 applications can upgrade with minimal changes. However, developers should still test applications for deprecation warnings.
Benefits of upgrading include:
cleaner syntax with the pipe operator
improved debugging tools
better URL parsing
new helper functions
improved developer ergonomics
Frameworks such as Laravel and Symfony typically adopt new PHP versions quickly, so developers should start testing compatibility.
Final Thoughts
PHP 8.5 continues the steady evolution of the language by improving readability, debugging capabilities, and developer experience. Features such as the pipe operator, URI extension, and Clone With support introduce more expressive and modern patterns to PHP development.
While this release does not radically change the language, it provides meaningful improvements that help developers write cleaner, more maintainable PHP code.