note 63593 deleted from function.array-map by bjori

From: Date: Fri, 24 Mar 2006 19:32:57 +0000
Subject: note 63593 deleted from function.array-map by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-106544@lists.php.net to get a copy of this message
Note Submitter: williamsn at bondware dot com Reason: bad code ---- I could be wrong, but IMHO the best way to perform array_map recursively AND preserve keys would be this: <?php # Apply a callback to an array and preserve keys, even if that array is multidimensional function x_array_map($callback, $array) { foreach($array as $k => $v) if(is_array($v)) $array[$k] = x_array_map($callback, $v); else $array[$k] = call_user_func($callback, $v); return $array; } ?>

« previous php.notes (#106544) next »