note 47776 deleted from function.array-map by philip
| From: | philip@php.net | Date: | Thu, 22 Feb 2007 02:02:15 +0000 |
| Subject: | note 47776 deleted from function.array-map by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123693@lists.php.net to get a copy of this message | ||
Note Submitter: Clayton Smith
----
Handle multidimensional arrays:
function array_map_recursive($func, $arr)
{
$result = array();
do
{
$key = key($arr);
if (is_array(current($arr))) {
$result[$key] = array_map2($func, $arr[$key]);
} else {
$result[$key] = $func(current($arr));
}
} while (next($arr) !== false);
return $result;
}