The Pipe Operator

Read the RFC Externals
92
268 yes
130 no

The "pipe operator" |> allows you to chain multiple function calls in a more convenient way.

$result = "Hello World"
    |> 'htmlentities'
    |> 'str_split'
    |> fn($x) => array_map('strtoupper', $x)
    |> fn($x) => array_filter($x, fn($v) => $v != 'O');

This RFC was already declined, but we're sharing it here as another test RFC, and because it'd be interesting to learn people's opinion about it.

Click the bar to cast your vote!
67%
33%
1

"Very good idea, but it would be nice to avoid using strings in the function calls."

Share:
gilbertrdzdev avatar
gilbertrdzdev
voted yes
1

Doesn't this proposal conflict with the Hack-like pipe operator where you can choose which argument to pipe into, using $$? This is not necessarily a no-vote, just a listed concern. :)

Also, the examples should use str_split(...) syntax, not strings, IMO.

Share:
olleharstedt avatar
olleharstedt
voted no

Check out another RFCs

new MyClass()->method() without parentheses

Chain method on newly created objects without parentheses

45
74 yes
15 no
Property Hooks

A new way of interacting with properties

66
130 yes
90 no
Interface Default Methods

Interface Default Methods improves backwards compatibility when changing interfaces, but also add a way to have multi-inheritance in PHP.

95
168 yes
264 no
RSS Feed Contribute Watch on YouTube Our License
© 2024 RFC Vote. This project is open source. Contribute and collaborate with us!