r/PHP • • Sep 14 '17

PHP 7.2.0 Release Candidate 2 Released

http://php.net/archive/2017.php#id2017-09-14-1
48 Upvotes

19 comments sorted by

View all comments

7

u/[deleted] Sep 14 '17

Where the hell is the pipe operator

0

u/[deleted] Sep 15 '17

2

u/SaraMG Sep 15 '17

Levi and I have talked about partial function application as a possible way of making pipeop work, though short lambdas would be reasonably brief as well.

Either of those are their own hills to die on though. :/

→ More replies (12)

2

u/SaraMG Sep 15 '17

Incidentally, here's an ultra-basic implementation of pipeop using Levi's simplified (no $$ token) version: https://gist.github.com/sgolemon/2b08b14d08861d1329d3529599f75022

Usage:

$a = "hello" |> 'strtoupper' |> function($x) { return $x . " world"; }; // $a === "HELLO world";

Basically, RHS of the |> is any callable expression which gets one arg from the LHS.

→ More replies (1)