Posted By

micmath on 12/20/07


Tagged


Versions (?)

recursive array_map for php4


 / Published in: PHP
 

in php5 use arraywalkrecursive

  1. function array_map_recursive($callback, $array) {
  2. $r = array();
  3. if (is_array($array)) {
  4. foreach($array as $key => $value) {
  5. $r[$key] = is_scalar($value) ? $callback($value) : array_map_recursive($callback, $value);
  6. return $r;
  7. }
  8. }
  9. }

Report this snippet  

You need to login to post a comment.