{"id":17705,"date":"2025-11-25T14:14:17","date_gmt":"2025-11-25T14:14:17","guid":{"rendered":"https:\/\/www.20i.com\/blog\/?p=17705"},"modified":"2026-01-09T16:15:38","modified_gmt":"2026-01-09T16:15:38","slug":"php-8-5","status":"publish","type":"post","link":"https:\/\/www.20i.com\/blog\/php-8-5\/","title":{"rendered":"PHP 8.5 is now available (and what&#8217;s new)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">From <a href=\"https:\/\/www.20i.com\/reseller-hosting\">Reseller Hosting<\/a> and <a href=\"https:\/\/www.20i.com\/wordpress-hosting\">Managed WordPress Hosting<\/a> to <a href=\"https:\/\/www.20i.com\/web-hosting\">Web Hosting<\/a> and <a href=\"https:\/\/www.20i.com\/managed-cloud-servers\">Managed Cloud Servers<\/a>, <strong>PHP\u202f8.5 is now fully deployed<\/strong> across the 20i platform.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That means you can take advantage of PHP 8.5&#8217;s performance improvements, cleaner syntax and developer\u2011friendly features.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Easily change any of your hosting packages&#8217; PHP version in My20i&#8217;s <a href=\"https:\/\/my.20i.com\/services\/bulk-php-management\">PHP Version Manager<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Resellers can make PHP 8.5 the default version for new packages in &#8216;<a href=\"https:\/\/my.20i.com\/reseller\/package-types\">Hosting Package Types<\/a>&#8216;. Simply edit your existing Package Type(s) or create a new one.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><em><strong>A note on WordPress:<\/strong> WordPress currently has&nbsp;<a href=\"https:\/\/make.wordpress.org\/core\/2025\/11\/21\/php-8-5-support-in-wordpress-6-9\/\" target=\"_blank\" rel=\"noreferrer noopener\">beta support<\/a>&nbsp;for PHP 8.5. Support for any given version of PHP is labelled as &#8220;beta support&#8221; until at least 10% of all WordPress sites are running that version or later.<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What\u2019s new in PHP 8.5?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">PHP 8.5 brings a range of developer\u2011focussed enhancements that aim to make code cleaner, safer and more expressive<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Pipe operator<\/strong><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">One of the most visible additions is the new <strong>pipe operator<\/strong> (|&gt;). This allows you to chain callables in a left\u2011to\u2011right style, passing the return value of each into the next. It reduces nested calls, improves readability and aligns with functional\u2011style patterns.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Example before PHP\u202f8.5:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$result = strtolower(\n    str_replace('.', '',\n        str_replace(' ', '-',\n            trim($title)\n        )\n    )\n);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>With PHP\u202f8.5:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$result = $title\n    |&gt; trim(...)\n    |&gt; (fn($str) =&gt; str_replace(' ', '-', $str))\n    |&gt; (fn($str) =&gt; str_replace('.', '', $str))\n    |&gt; strtolower(...);<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This means fewer temp variables, clearer pipeline logic for data transformations, and easier maintenance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. URI extension (built\u2011in)<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PHP\u202f8.5 introduces a new built\u2011in <strong>URI extension<\/strong> for parsing, normalising and manipulating URLs\/URIs according to RFC\u202f3986 and WHATWG standards.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This means developers no longer need to rely on third\u2011party libraries for robust URL handling. You can use something like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>use Uri\\Rfc3986\\Uri;\n\n$uri = new Uri('https:\/\/example.com\/path?query=1');\necho $uri-&gt;getHost(); \/\/ example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This new feature simplifies reliable URL parsing, sanitisation and manipulation, which helps when building link\u2011builders, redirect logic, or multi\u2011tenant router systems.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">3. Clone with \/ Immutable cloning enhancements<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Another significant improvement is the enhanced <code>clone<\/code> usage. Yu can now pass a second parameter to <code>clone()<\/code> to override properties during cloning, enabling more concise \u201cwith\u2011er\u201d patterns especially for readonly or immutable objects.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>readonly class Colour {\n    public function __construct(\n        public int $red,\n        public int $green,\n        public int $blue,\n        public int $alpha = 255,\n    ) {}\n    public function withAlpha(int $alpha): self {\n        return clone($this, &#091;\n            'alpha' =&gt; $alpha,\n        ]);\n    }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">For frameworks, plugins or large scale apps, this gives a cleaner immutable\u2011friendly API, reducing boilerplate for object state transformations.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">4. New utility functions and helper features<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">There are several additions that enhance everyday developer ergonomics:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>array_first()<\/code> and <code>array_last()<\/code> functions to directly access the first and last values of an array.<\/li>\n\n\n\n<li>New functions <code>get_error_handler()<\/code> and <code>get_exception_handler()<\/code> to retrieve the current handlers rather than having to rely on hacks. <\/li>\n\n\n\n<li><code>locale_is_right_to_left()<\/code> (and method <code>Locale::isRightToLeft()<\/code>) to test whether a given locale writes right\u2011to\u2011left \u2014 useful for i18n \/ UI logic.<\/li>\n\n\n\n<li>A new <code>PHP_BUILD_DATE<\/code> constant so you can check the build timestamp of the PHP binary.<\/li>\n\n\n\n<li>CLI addition: <code>php --ini=diff<\/code> which shows only INI settings that deviate from defaults. <\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. Attribute and constant expression enhancements<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Other language refinements include:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Support for closures and first\u2011class callables inside constant expressions (e.g., attributes, default values), expanding compile\u2011time expressiveness.<\/li>\n\n\n\n<li>The <code>#[\\NoDiscard]<\/code> attribute, which enables you to mark functions so that their return value must be used (or explicitly ignored via <code>(void)<\/code>), helping to prevent subtle bugs.<\/li>\n\n\n\n<li>Allowing attributes on constants (not just classes and methods).<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">6. Deprecations and removals to note<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">As always, each major version includes cleanup. In PHP\u202f8.5 some functions and practices are deprecated or removed:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Non\u2011canonical scalar type casts are deprecated (e.g., <code>boolean|double|integer|binary<\/code>).<\/li>\n\n\n\n<li><code>curl_close<\/code> and <code>curl_share_close<\/code> are deprecated because they have been effective no\u2011ops in PHP\u202f8.0+. <\/li>\n\n\n\n<li><code>xml_parser_free<\/code> is deprecated for similar reasons.<\/li>\n\n\n\n<li><code>socket_set_timeout<\/code> is deprecated in favour of <code>stream_set_timeout<\/code>.<\/li>\n\n\n\n<li>On the removal front: the CLI\/CGI options <code>-z \/ --zend-extension<\/code> have been removed.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Projects upgrading should review their codebase (and dependencies) for use of deprecated features and ensure compatibility ahead of full production roll\u2011out.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Upgrade considerations<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We usually see faster websites on newer PHPs so we encourage people to upgrade. When preparing to support or upgrade to PHP\u202f8.5 we recommend the following checklist:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Audit your codebase and dependencies for deprecated functions (per section above).<\/li>\n\n\n\n<li>Test applications on PHP\u202f8.5 in a staging environment: check for compatibility, error logs and performance.<\/li>\n\n\n\n<li>Verify that any custom PHP extensions (especially 3rd\u2011party or older ones) are compatible with PHP\u202f8.5.<\/li>\n\n\n\n<li>Update deployment pipelines or CI\/CD to recognise the new <code>PHP_BUILD_DATE<\/code> constant and other diagnostics.<\/li>\n\n\n\n<li>Communicate to developers and end\u2011clients that you\u2019re supporting PHP\u202f8.5, highlighting benefits such as cleaner code, modern features and longer support lifecycle.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Final thoughts<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">PHP\u202f8.5 delivers a substantial collection of well\u2011thought\u2011out improvements that directly address everyday developer needs: readability (pipe operator), expressiveness (clone with, closures in constants), utility (array_first\/last, locale checks), and hosting\/top\u2011level tooling (URI extension, CLI diff).<\/p>\n\n\n<div class='code-block code-block-3' style='margin: 8px 0; clear: both;'>\n<hr>\n<br \/>\n<H4>Upgrade your hosting \ud83d\udcc8 Unleash your websites \ud83d\ude80<\/h4>\n<p>Build, deploy & manage all your sites\/apps at scale. Use our high-spec cloud servers to ensure blazing-fast load times, every time. Get market-leading speed, security & customer support.<\/p>\n<ul>\n<li>WordPress, WooCommerce, Laravel optimisations &amp; more<\/li>\n<li>One click migration from any host, any time<\/li>\n<li>Free Email, DNS, CDN, SSL, SSH, Backups, Security &amp; Git integration all baked-in<\/li>\n<li>Global reach with 60+ global data centres<\/li>\n<li>Award-winning support from real people<\/li>\n<\/ul>\n<p>Find out why over 1 million agencies, online stores, developers, multi-site hosting and high traffic sites use our <a href=\"https:\/\/www.20i.com\/managed-cloud-servers\">Managed Cloud Servers<\/a> to ensure peak performance, every time.<\/p>\n<br \/><br \/>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"From Reseller Hosting and Managed WordPress Hosting to Web Hosting and Managed Cloud Servers, PHP\u202f8.5 is now fully&hellip;","protected":false},"author":13,"featured_media":17711,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"ub_ctt_via":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"csco_singular_sidebar":"","csco_page_header_type":"","csco_page_load_nextpost":"","footnotes":""},"categories":[46],"tags":[50,81,79],"class_list":["post-17705","post","type-post","status-publish","format-standard","has-post-thumbnail","category-20i","tag-20i","tag-internet","tag-web-development","cs-entry"],"featured_image_src":"https:\/\/www.20i.com\/blog\/wp-content\/uploads\/2025\/11\/php-8.5-20i.png","author_info":{"display_name":"Matthew Telfer","author_link":"https:\/\/www.20i.com\/blog\/author\/matthew-telfer\/"},"_links":{"self":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/17705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/comments?post=17705"}],"version-history":[{"count":13,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/17705\/revisions"}],"predecessor-version":[{"id":18239,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/posts\/17705\/revisions\/18239"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media\/17711"}],"wp:attachment":[{"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/media?parent=17705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/categories?post=17705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.20i.com\/blog\/wp-json\/wp\/v2\/tags?post=17705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}