Last active
June 8, 2020 13:42
-
-
Save jbbn/047468786e6aaaa6648e94e082453ca2 to your computer and use it in GitHub Desktop.
[draft] improvised 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 ($fns) { | |
return function ($value) use ($fns) { | |
return array_reduce( | |
$fns | |
, function ($previousValue, $fn) { | |
return call_user_func($fn, $previousValue); | |
} | |
, $value | |
); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment