note 47776 modified in function.array-map by didou

From: Date: Mon, 10 Jan 2005 03:17:34 +0000
Subject: note 47776 modified in function.array-map by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-83026@lists.php.net to get a copy of this message
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; } --was-- 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]); $result += $result[$key]; } else { $result[$key] = $func(current($arr)); } } while (next($arr) !== false); return $result; } http://php.net/manual/en/function.array-map.php

« previous php.notes (#83026) next »