Return to Snippet

Revision: 4482
at December 20, 2007 06:39 by micmath


Initial Code
function array_map_recursive($callback, $array) {
	$r = array();
	if (is_array($array)) {
		foreach($array as $key => $value) {
			$r[$key] = is_scalar($value) ? $callback($value) : array_map_recursive($callback, $value);
			return $r;
		}
	}
}

Initial URL

                                

Initial Description
in php5 use array_walk_recursive

Initial Title
recursive array_map for php4

Initial Tags

                                

Initial Language
PHP