function patterns_array_map in Patterns 7.2
Same name and namespace in other branches
- 6.2 patterns.module \patterns_array_map()
- 7 includes/unused.inc \patterns_array_map()
For use with token replacement
File
- includes/
unused.inc, line 295 - Functions that are unused at the moment.
Code
function patterns_array_map($function, $array, $params) {
$new_array = array();
foreach ($array as $key => $value) {
if (is_array($value)) {
$new_array[$key] = patterns_array_map($function, $value, $params);
}
else {
$params[] = $key;
$key = call_user_func_array($function, $params);
array_pop($params);
$params[] = $value;
$new_array[$key] = call_user_func_array($function, $params);
array_pop($params);
}
}
return $new_array;
}