Re:PHP 8.5 Adds Pipe Operator: What it means
by chuck8088 on Tuesday August 05, 2025 @08:43AM
(#44797317)
This article makes a great case WHY the pipe operator is useful, but why didn't they just rewrite those functions to support method chaining?
`
$profit = [1, 4, 5]
.loadSeveral()
.filter(isOnSale())
.map(sellWidget())
.array_sum();
`
this has the side benefit of 'looking normal'
[ Parent
| on HN ]
Re:PHP 8.5 Adds Pipe Operator: What it means
by wsatb on Tuesday August 05, 2025 @08:50AM
(#44797381)
Backwards compatibility. The language has done a pretty amazing job at adding features over the last 10 years without really breaking a lot of old code. I believe PHP still runs about 75% of the internet, so that's pretty huge.
Re:PHP 8.5 Adds Pipe Operator: What it means
by moebrowne on Tuesday August 05, 2025 @08:54AM
(#44797425)
The Python 2 to 3 upgrade is a example of how important backwards compatibility is