What’s new in PHP 8.5?
Hey fellow devs,
PHP 8.5 has officially landed, following a solid cycle of release candidates (RC5 dropped on November 13). With no further RCs needed, the stable GA release is now out in the wild. If you’re running WordPress sites (or any PHP app, really), this is a smooth, mostly additive upgrade from 8.4 – no major breaking changes, just a stack of quality-of-life improvements that make your code cleaner and debugging far less painful.
Test PHP 8.5 safely in minutes
Need a fast way to check your site or plugin against PHP 8.5? UpdraftClone lets you spin up a full staging site in a couple of minutes – no hosting setup, no server config, no risk to your live site.
Key improvements introduced in PHP 8.5
Section titled Key improvements introduced in PHP 8.5Here’s a rundown of what’s actually useful in PHP 8.5 that (as a WP dev) you can use day to day.
1. The pipe operator |> – finally!
Section titled 1. The pipe operator |> – finally!
This really is a headline feature. Instead of deeply nested calls, you can chain functions left-to-right and make your code far more readable.
// Before (ugh)
$result = trim(strtoupper(str_replace('world', 'PHP devs', $input)));
// PHP 8.5 – readable mode
$result = $input
|> str_replace('world', 'PHP devs', $$)
|> strtoupper($$)
|> trim($$);
WordPress relevance
Perfect for sanitising input, building URLs, or processing data in hooks/filters without a million temp variables. WP hooks often have to pass data through several transformations – this streamlines that.
Limitations to note
- The callable used in
|>must accept exactly one required parameter; you can’t use it with functions expecting multiple params or references (except a few built-ins). - It still won’t replace every case of nested calls, but it’s a game-changer for many transformations.
2. array_first() and array_last() – about time
Section titled 2. array_first() and array_last() – about time
We’ve had array_key_first() and array_key_last() since PHP 7.3. But now PHP 8.5 gives us proper value-based equivalents:
$first = array_first($posts); // first element or null
$last = array_last($posts); // last element or null
No more reset(), end(), or messing with internal array pointers. Super handy when you’re looping over WP_Query results, retrieving the first/last item from a transient or a REST response.
3. Better fatal-error debugging
Section titled 3. Better fatal-error debuggingOne big ops win: fatal errors now show full stack traces by default (controlled via fatal_error_backtrace=On in the ini). Less “your plugin died somewhere, good luck finding it”. Much better for tracking down which plugin/theme misbehaved on certain hosts.
4. New URI extension – proper URL handling
Section titled 4. New URI extension – proper URL handlingThere’s a brand-new immutable Uri class, supporting both RFC 3986 and WHATWG URL standards. Example:
use Uri\Rfc3986\Uri;
$uri = new Uri('https://example.com/path?query#fragment');
$uri->getHost(); // example.com
$new = $uri->withPath('/new-path'); // returns new immutable instance
Why this matters for WordPress
Yes, WP still uses WP_Http and lots of custom URL handling, but if you build custom APIs, redirects, or do complex external-URL handling, this is parse_url() + manual rebuild on steroids.
5. Handy new functions & constants
Section titled 5. Handy new functions & constantsHere are some smaller but useful additions:
get_error_handler() and get_exception_handler()– now you can introspect current handlers; great when digging into plugin/theme conflicts.locale_is_right_to_left() / Locale::isRightToLeft()– tighter RTL language support (useful for multilingual WP sites).curl_multi_get_handles() – simplifies cURL multi-handle management (good for batching external requests).PHP_BUILD_DATEconstant – useful to know exactly when your PHP binary was built (ops/hosting insight).- CLI addition:
php --ini=diff– shows only non-default ini settings; very handy for spotting host differences.
6. Performance & ops wins
Section titled 6. Performance & ops wins- Persistent cURL sharing across requests – faster HTTP operations when you’ve got long-running PHP processes.
- OPcache file cache now works on read-only filesystems – especially relevant for containerised or Lambda-style deployments.
- Various JIT & memory improvements – nothing earth-shattering, but in a busy WP site every millisecond counts.
Deprecations & minor breaks (nothing scary for WP)
Section titled Deprecations & minor breaks (nothing scary for WP)Mostly cleanup work:
- The old
Directory()class is finally gone. - A few old reflection inconsistencies are fixed.
- Some edge-case deprecations have been introduced which 99% of mainstream WP plugins won’t hit.
And because WP core already tests against the RC builds, compatibility is already confirmed in practice.
Should you upgrade to PHP 8.5 right now?
Section titled Should you upgrade to PHP 8.5 right now?Short answer: yes, soon – but with all the usual precautions.
This isn’t the type of release like PHP 8.0, which shook up everything with JIT and attributes. PHP 8.5 is more akin to your favourite IDE finally getting the refactor shortcuts you’ve wanted since 2019. Incremental, additive, low-risk.
Upgrade path advice
Section titled Upgrade path advice- Always back up everything (database + files). Even if your host says “we do it for you” – one day they’ll accidentally keep only a 7-day retention and you’ll cry.
- Spin up a staging/copy site
- Switch the staging site to PHP 8.5 and thoroughly test: front-end, admin, checkout flows, contact forms, and that weird inherited plugin.
- Run a PHP compatibility check (e.g., the Tideways/PHPCompatibility suite) just in case.
- If you’re already on PHP 8.2, 8.3 or 8.4 – upgrade is trivial, breaking changes for core and mainstream plugins are basically non-existent.
- If you’re still on PHP 8.1 – you should upgrade anyway; support ended almost a year ago.
- If you’re still on PHP 8.0 or (heaven forbid) 7.4 – stop reading this blog and go upgrade right now. Those versions are end-of-life, unpatched, and a walking CVE. Seriously.
Major hosts will have 8.5 available in their control panels very shortly (some already allow selecting RC builds). So yes – upgrade soon, upgrade confidently, but upgrade responsibly.
Back up before upgrading to PHP 8.5
Testing PHP 8.5 is easy when you know you can roll back in seconds. UpdraftPlus creates full WordPress backups in one click and stores them securely offsite, so you can switch versions confidently.
Final word
Section titled Final wordThat’s PHP 8.5 in a nutshell, not revolutionary like 8.0, but a rock-steady “finally!” release that removes loads of daily annoyances. Cleaner code, fewer “wtf” moments, and one more reason to feel slightly superior to the JavaScript kids.
Now go forth, spin up a clone to test everything and make sure you’ve got a full backup ready to roll back if needed. I’ll see you on the other side.
About the author
Becks Faulkner
Becks is the SEO Manager at Updraft WP Software Ltd. She has specialised in search engine marketing for over 11 years. Her background spans various industries, with a primary focus in financial and tech sectors. She is driven by her passion for enhancing organic visibility with holistic SEO strategies.
Categories
UpdraftPlus
Get all our premium features. Direct site-to-site migration, incremental backups, back up automatically before updates and a whole lot more.
From just $70 for the year.
More stories
-
How to download a WordPress site
Need a copy of your WordPress site? Learn the easiest way to download your full site safely using UpdraftPlus, no technical steps required.
-
Best WordPress themes for accessibility in 2025
Discover the best WordPress themes for accessibility – ADA and WCAG-ready options that help you build a fast, inclusive, and user-friendly site.
-
6 reasons you need a security plugin for WordPress
Not sure if you need a WordPress security plugin? Learn six reasons why it’s essential for every site and how AIOS keeps yours protected.
-
How to prepare your business for Black Friday
Learn how to prepare your business for Black Friday with practical steps, expert tips, and a checklist to keep your WordPress site fast, secure, and ready for traffic.