Re: [RFC] Pipe Assignment Operator
| From: | Caleb White | Date: | Tue, 14 Jul 2026 18:17:34 +0000 |
| Subject: | Re: [RFC] Pipe Assignment Operator | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-131922@lists.php.net to get a copy of this message | ||
On Mon, 13 Jul 2026 15:54:36 +0000, Holly Schilling wrote:
> I won’t get to vote on this RFC, but I wanted to give my brief opinion. To be fair, my
> initial opinion was that I loved the symmetry of this along with
+=,
> -=, and similar operators, but really hated how I assumed it was
> likely be used. I started typing up a message showing examples of how it could be used, but as I did
> I fell in love with it.
>
> It’s a little annoying to type on the standard US Keyboard layout, but its readable as a
> syntax and has a clear meaning once understood. This is the example that made me really love the
> <> operator (with PFA):
>
> ```
> $array |>= array_map(transform(…), …);
> ```
Glad you like it! I think it will really clean up a lot of code, particularly since
- it removes the need to duplicate the variable name on both sides
- it is more performant (through memoization) when there's an expression
involved without having to introduce an intermediate variable.
I think would be fantastic if this landed with PFA
Best,
Caleb