News for hackers. Stuff that matters.
Re:PHP 8.5 Adds Pipe Operator: What it means by bapak on Tuesday August 05, 2025 @01:59AM (#44794754)
It's chaining without having to vary the return of each function. In JS you cannot call 3.myMethod(), but you could with 3 |> myMethod
Re:PHP 8.5 Adds Pipe Operator: What it means by cyco130 on Tuesday August 05, 2025 @02:19AM (#44794848)
It requires parentheses `(3).myMethod()` but you can by monkey patching the Number prototype. Very bad idea, but you absolutely can.
Re:PHP 8.5 Adds Pipe Operator: What it means by senfiaj on Sunday August 10, 2025 @10:59AM (#44855633)
You can just add extra dot: `3..myMethod()`.
Re:PHP 8.5 Adds Pipe Operator: What it means by EGreg on Tuesday August 05, 2025 @10:20AM (#44798311)
Not only that

In chaining, methods all have to be part of the same class.

In C++ we had this stuff ages ago, it’s called abusing streaming operators LMAO