Created
February 26, 2015 03:59
-
-
Save marcelaraujo/67ee06794753fdcec042 to your computer and use it in GitHub Desktop.
The most memory-efficient array_map_recursive()
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 array_map_recursive(callable $func, array $arr) { | |
array_walk_recursive($arr, function(&$v) use ($func) { | |
$v = $func($v); | |
}); | |
return $arr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment