Created
March 7, 2022 06:34
-
-
Save iiidefix/4b53d835a46fa2fd7431f53bc5d333ef to your computer and use it in GitHub Desktop.
simple php pipe function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function pipe($value, ...$funcs) { | |
return array_reduce($funcs, fn($v, $f) => $f($v), $value); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage