With PHP 8.5, developers get a release that is not just about a few cosmetic language tweaks. This version introduces several features that improve readability, modernize common coding patterns, and sharpen the language in ways that will be noticeable in real projects.
At the same time, PHP 8.5 is not a release you should upgrade to blindly. Alongside the new features, there are also deprecations and behavior changes that can affect older codebases. That combination makes PHP 8.5 especially interesting: it adds useful new tools, but it also expects developers to clean up some legacy habits.
The pipe operator finally arrives
One of the most visible additions in PHP 8.5 is the new pipe operator |>. It allows values to be passed from left to right through a sequence of operations, making certain transformation chains much easier to read.
This does not completely change what PHP can do, but it does improve readability in places where code previously relied on deeply nested function calls or unnecessary temporary variables. For many developers, that alone will make day-to-day PHP code feel cleaner and more natural.
Constant expressions become more flexible
PHP 8.5 also expands what can be used inside constant expressions. Static closures and first-class callables are now supported in places such as attribute parameters, property defaults, parameter defaults, and constants.
This is not the kind of feature every project will use immediately, but it matters for framework-level code, reusable libraries, and more expressive metadata definitions.
#[\\NoDiscard] makes APIs safer
One of the most useful additions for API design is #[\\NoDiscard]. This attribute allows developers to mark return values that should not be silently ignored. If a function result is dropped accidentally, tools can now warn about it more reliably.
Related to this, PHP 8.5 also adds the (void) cast, which makes it explicit that a return value is being discarded intentionally. Together, these two additions improve communication between code, tools, and developers.
The new URI extension is more important than it looks
Another major addition is the built-in URI extension. PHP now includes native support for parsing, normalizing, and working with URIs and URLs in a more structured way. That is especially relevant for web-facing applications where URLs matter for routing, API handling, validation, and link generation.
This may not sound flashy at first, but it points toward a more modern and better structured standard library.
Useful smaller additions matter too
Beyond the headline features, PHP 8.5 includes several smaller improvements that are still worth paying attention to:
- attributes on non-class constants
#[\\Override]for properties- asymmetric visibility for static properties
- backtraces for fatal errors
- new helpers such as
array_first()andarray_last()
These details may not generate the biggest headlines, but they often deliver the most practical value over time.
Under-the-hood changes are relevant as well
PHP 8.5 also comes with multiple technical improvements. That includes performance and diagnostics work, plus a changed situation around Opcache: the extension is now always built into the PHP binary and always loaded.
That does not automatically rewrite your runtime configuration, but it does matter for deployments, packaging, and Docker-based setups. If you maintain your own build or hosting stack, this deserves a quick review.
Deprecations are the part you should not ignore
As helpful as the new features are, the upgrade story is just as important. PHP 8.5 deprecates several things that still appear in older or messy codebases:
- non-canonical cast names such as
(boolean)and(integer) - the backtick operator as an alias for
shell_exec() casestatements terminated with a semicolon instead of a colon- returning
nullfrom__debugInfo()
There are also soft deprecations around __sleep() and __wakeup(), with __serialize() and __unserialize() being the modern replacement. In addition, using null as an array offset is now deprecated.
Runtime behavior became stricter in a few places
PHP 8.5 does not only add deprecations. It also tightens runtime behavior in several areas. That includes warnings when floats or float-like strings are cast to int even though they cannot be represented cleanly, and warnings around casting NAN to other types.
These changes can look minor, but they are exactly the kind of detail that can break tests or surface noisy warnings in older projects.
What I would check before upgrading to PHP 8.5
If you plan to move an existing application to PHP 8.5, the important part is not just learning the new syntax. The more valuable work is checking for compatibility risks and deprecation warnings before the upgrade becomes urgent.
- Search for old cast forms like
(boolean),(integer),(double), and similar aliases. - Check for backticks and replace them with clearer alternatives where appropriate.
- Review older serialization logic using
__sleep()and__wakeup(). - Look for
nullused as an array offset or in similar legacy patterns. - Run tests carefully and pay attention to warnings, not just fatal errors.
Conclusion
PHP 8.5 is a strong release because it improves multiple layers of the language at once. It adds visible syntax improvements like the pipe operator, introduces more deliberate APIs like the URI extension, and improves code quality with tools such as #[\\NoDiscard].
At the same time, it sends a clear message that older patterns should be cleaned up. That is not a downside. It is part of how PHP keeps moving forward.