-
-
Save alixaxel/d8fc7f6984a8099ab86f to your computer and use it in GitHub Desktop.
FlatMap implementation in PHP, following the Reactive Extensions intiative
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
function flatMap($data, \Closure $p) | |
{ | |
$collection = call_user_func_array("array_map", array($p)); | |
return iterator_to_array(new \RecursiveIteratorIterator( | |
new \RecursiveArrayIterator($data)), false); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment