Skip to content

Instantly share code, notes, and snippets.

@jbottigliero
Created February 21, 2013 21:07
Show Gist options
  • Select an option

  • Save jbottigliero/5008262 to your computer and use it in GitHub Desktop.

Select an option

Save jbottigliero/5008262 to your computer and use it in GitHub Desktop.
iterator_map_to_array PHP funciton
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