php version guide
PHP 8.5 Changes
PHP 8.5 adds the pipe operator, an always-available URI extension, clone() with changed properties, #[\NoDiscard], a (void) cast, and other runtime and extension improvements.
Changes Worth Recognising
- The pipe operator passes a value through callables from left to right.
- The URI extension provides RFC 3986 and WHATWG URL handling APIs.
clone($object, [...])supports concise value-object copies with changed properties.#[\NoDiscard]warns when an important return value is ignored;(void)marks intentional discard.
Upgrade Review
- Confirm production is actually running PHP 8.5 before adopting syntax.
- Choose RFC 3986 or WHATWG URI semantics deliberately.
- Use new syntax where it improves readability, not merely to rewrite stable code.
The next lessons examine the most visible PHP 8.5 additions individually.
Practice
Choose an 8.5 Adoption Candidate
Review a small code path containing nested string transforms, URI parsing, or readonly value-object copying. Identify one PHP 8.5 feature that could make the code clearer and one compatibility constraint.
Show solution
A good answer names a concrete feature such as |>, Uri\Rfc3986\Uri, or clone($object, [...]), then records that every runtime and static-analysis tool must support PHP 8.5 first.