Hi guys
In the following function ...
1. how do I prevent $array_flat from being reset during the recursion without using $GLOBALS/global or sessions ?
2. how could I grab the name of the function currently running so that I don't have to state "hd_array_multi_to_flat" a second time?
Thanks a lot!
In the following function ...
1. how do I prevent $array_flat from being reset during the recursion without using $GLOBALS/global or sessions ?
2. how could I grab the name of the function currently running so that I don't have to state "hd_array_multi_to_flat" a second time?
Thanks a lot!
Code:
function hd_array_multi_to_flat($array_multi, $where = "array") {
while (list($key,$value) = each($array_multi)) {
if (is_array($value)) {
hd_array_multi_to_flat($value, $where . "[$key]");
} else {
for ($i=0; $i<count($value);$i++) {
$array_flat[] = $key;
$array_flat[] = $value;
}
}
}
return $array_flat;
}