PHP 8.5 lays down long-awaited pipe operator, adds new URI tools
- Reference: 1763672635
- News link: https://www.theregister.co.uk/2025/11/20/php_85_lays_pipe_operator/
- Source link:
PHP, short for Personal Home Page when initially released in 1995 by Rasmus Lerdorf, now stands for PHP: Hypertext Preprocessor. [1]Version 8.5 is a major release that brings with it a handful of useful new capabilities. It follows PHP 8.4, which debuted a year ago.
Chief among these is the addition of a [2]pipe operator .
[3]
"I don't think it's immodest to say that the pipe operator has one of the highest 'bangs for the buck' of any feature in recent memory, alongside such niceties as constructor property promotion," [4]wrote Larry Garfield, a member of the PHP-FIG (framework interop group) core committee, back in July. $arr = [
new Widget(tags: ['a', 'b', 'c']),
new Widget(tags: ['c', 'd', 'e']),
new Widget(tags: ['x', 'y', 'a']),
];
$result = $arr
| fn$x array_column($x, 'tags') // Gets an array of arrays
| fn$x array_merge(...$x) // Flatten into one big array
| array_unique(...) // Remove duplicates
| array_values(...) // Reindex the array.
;
// $result is ['a', 'b', 'c', 'd', 'e', 'x', 'y']
The pipe operator allows function calls to be chained together, which avoids the extraneous variables and nested statements that might otherwise be involved. Pipes tend to make code more readable than other ways to implement serial operations.
[5]Nvidia pushes out hotfix after Windows 11 October update tanks gaming performance
[6]Trump, Republicans try again to stop states from regulating AI
[7]Thunderbird 145 finally adds 'native' Exchange support
[8]It's a good time to be the arms dealer for the AI boom
Anyone familiar with the Unix/Linux command line or programming languages like [9]R , [10]F# , [11]Clojure , or [12]Elixir may have used the pipe operator. In JavaScript, aka ECMAScript, [13]a pipe operator has been proposed , though there are alternatives like method chaining.
Another significant addition is the [14]URI extension , which allows developers to parse and modify URIs and URLs based on both the RFC 3986 and the WHATWG URL standards. Parsing with URIs and URLs – reading them and breaking them down into their different parts – is a rather common task for web-oriented applications. use Uri\Rfc3986\Uri;
$uri = new Uri('https://php.net/releases/8.5/en.php');
var_dump($uri-getHost());
// string(7) "php.net"
Yet prior versions of PHP didn't include a standards-compliant parser in the standard library. As [15]noted by software developer Tim Düsterhus, the [16]parse_url() function that dates back to PHP 4 doesn't follow any standard and comes with a warning that it should not be used with untrusted or malformed URLs.
Other noteworthy additions to the language include: [17]Clone With , for updating properties more efficiently; the [18]#[\NoDiscard] attribute , for warning when a return value goes unused; the ability to use [19]static closures and first-class callables in constant expressions; and [20]persistent cURL handles that can be shared across multiple PHP requests.
[21]
Code written in PHP generally relies on an interpreter, like the Zend Engine, that runs on a web server rather than being compiled into binary files. It can interface with third-party tools such as databases and output dynamically-generated web content in HTML or other languages.
PHP serves as the basis for WordPress, which accounts for about [22]43 percent of all websites , and for the Laravel web application development framework.
[23]
As for its popularity, PHP is either [24]in decline or [25]stable , depending upon which JetBrains survey one consults. It presently [26]ranks 16th in the Tiobe Programming Language Index, down from 12th a year ago. ®
Get our [27]Tech Resources
[1] https://www.php.net/releases/8.5/en.php#features
[2] https://www.php.net/releases/8.5/en.php#pipe-operator
[3] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/applications&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2aR-dinb8tPMrSxFD5RQkCQAAAFE&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0
[4] https://thephp.foundation/blog/2025/07/11/php-85-adds-pipe-operator/
[5] https://www.theregister.com/2025/11/20/nvidia_windows_11_hotfix/
[6] https://www.theregister.com/2025/11/20/trump_republicans_trying_again_to/
[7] https://www.theregister.com/2025/11/20/thunderbird_microsoft_exchange_support/
[8] https://www.theregister.com/2025/11/19/nvidia_earnings_q3_2025/
[9] https://r4ds.had.co.nz/pipes.html
[10] https://camilotk.github.io/fsharp-by-example/chapters/pipe/
[11] https://clojure.org/guides/threading_macros
[12] https://elixirschool.com/en/lessons/basics/pipe_operator
[13] https://tc39.es/proposal-pipeline-operator/
[14] https://www.php.net/releases/8.5/en.php#new-uri-extension
[15] https://thephp.foundation/blog/2025/10/10/php-85-uri-extension/
[16] https://www.php.net/manual/en/function.parse-url.php
[17] https://www.php.net/releases/8.5/en.php#clone-with
[18] https://www.php.net/releases/8.5/en.php#no-discard-attribute
[19] https://www.php.net/releases/8.5/en.php#closures-in-const-expr
[20] https://www.php.net/releases/8.5/en.php#persistent-curl-share-handles
[21] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/applications&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44aR-dinb8tPMrSxFD5RQkCQAAAFE&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[22] https://w3techs.com/technologies/details/cm-wordpress
[23] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/applications&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44aR-dinb8tPMrSxFD5RQkCQAAAFE&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[24] https://www.theregister.com/2025/10/21/massive_jetbrains_dev_survey/
[25] https://blog.jetbrains.com/phpstorm/2025/10/state-of-php-2025/
[26] https://www.tiobe.com/tiobe-index/
[27] https://whitepapers.theregister.com/