PHP 8.5 Has Landed: The Pipe Operator and Other Changes Worth Knowing

PHP 8.5 arrived this month with the long-awaited pipe operator, a new URI extension and plenty of quality-of-life improvements. Here's a practical rundown and our upgrade advice.

PHP 8.5 Has Landed: The Pipe Operator and Other Changes Worth Knowing

A year ago we wrote about PHP 8.4. Now PHP 8.5 is out, and it's another solid release. Nothing earth-shattering for business owners, but several features that make day-to-day development nicer. Here's what's worth knowing.

The pipe operator

The headline feature is the pipe operator, |>. It passes the result of one expression into the next function, so you can read a chain of transformations from left to right instead of from the inside out.

Before, cleaning up a string might look like trim(strtolower(strip_tags($input))), which you read backwards. With the pipe operator, it becomes $input |> strip_tags(...) |> strtolower(...) |> trim(...), which reads in the order things actually happen.

It's not going to change how we architect applications, but for data transformation code it's much easier to follow.

A proper URI extension

PHP finally has a built-in, standards-compliant way to parse and work with URLs. The old parse_url() function has well-known quirks and doesn't follow modern URL standards. The new URI extension gives you proper objects that follow the relevant specifications. If you handle redirects, webhooks or user-submitted links, this is a meaningful improvement for correctness and security.

Smaller improvements we like

  • array_first() and array_last(), finally. Getting the first or last value of an array no longer requires reset() or array_key_first() gymnastics.
  • Clone with properties. You can modify properties while cloning, which is useful for immutable objects with readonly properties.
  • #[\NoDiscard] attribute, which warns when a function's return value is ignored. Great for functions where ignoring the result is almost always a bug.
  • Better fatal error backtraces, which makes debugging production issues easier.
  • A handful of deprecations, including some old casting syntax and the backtick operator as an alias for shell_exec().

Support timelines

With 8.5 out, here's where things stand:

  • PHP 8.1 reaches end of life at the end of this year. If you're on it, move now.
  • PHP 8.2 gets security fixes only, until the end of 2026.
  • PHP 8.3 and 8.4 are fully supported.
  • PHP 8.5 is the new current version.

Our upgrade advice

For client sites, our rule is the same as always: don't upgrade to a brand-new version in its first month unless there's a reason. Give frameworks, plugins and hosting providers time to catch up. We'll start moving custom applications to 8.5 early next year, after testing on staging.

What we're doing right now is checking every client site still on PHP 8.1 or older and scheduling upgrades before the end of the year. That matters far more than any new feature.

If you're not sure which PHP version your site runs on, your hosting control panel will usually show it, or ask your developer. It's a five-minute check that could save you from running unsupported software.

Y
Written by the YPage Technologies team

We design and build websites, web applications and SaaS products for growing businesses, and share what we learn along the way.

Work with us

Ready to start your next project?

Let's talk about your website, web app or digital product.

Get in touch