note 94265 deleted from function.array-map by danbrown
| From: | danbrown@php.net | Date: | Mon, 26 Oct 2009 13:55:50 +0000 |
| Subject: | note 94265 deleted from function.array-map by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-162113@lists.php.net to get a copy of this message | ||
Note Submitter: arnold at adaniels dot nl
----
A better function to do array_map recursively is:
<?php
function array_map_recursive($fn, $array)
{
foreach ($array as &$item) {
$item = is_array($item) ? array_map_recursive($fn, $item) : $fn($item);
}
return $array;
}
?>