Created
February 21, 2013 21:07
-
-
Save jbottigliero/5008262 to your computer and use it in GitHub Desktop.
iterator_map_to_array PHP funciton
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 iterator_map_to_array(\Iterator $iterator, $callback, $use_keys = true){ | |
| foreach($iterator as $i){ | |
| $i = $callback($i); | |
| } | |
| return iterator_to_array($iterator, $use_keys); | |
| } | |
| return iterator_map($cursor, function($i){ | |
| return new MyObject($i); | |
| }, false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment