array_walk_recursive get return value
Flatten multidimensional associative array to array
function flatten(array $array, $prefix="") {
$result = Array();
array_walk($array, function ($value, $key) use ($array, $prefix, &$result) {
$path = $prefix ? "$prefix.$key" : $key;
if (is_array($value)) {
$result = array_merge($result, flatten($value, $path));
} else {
$result[$path] = $value;
}
});
return $result;
}
print_r(flatten($arrr));
from site:
https://stackoverflow.com/questions/39071537/array-walk-recursive-to-return-array-name-rather-than-index-number