array_merge doesn't work for me. The passed array could be of any
depth, so I need to do it recursively.
I have done this:
function transform($input, $key_data = array()) {
    foreach ($input AS $key => $value) {
        if(is_array($value)) {
             $key_data[] = $key;
             transform($input[$key], $key_data);
        } else {
            $key_vals = implode(".", $key_data);
            print_r( array($key_vals.".".$key => $value));
        }
    }
}
The problem is that when I go deeper I store the key, and I need to
unset the key of the deeper levels when I go upper after that. But
can't manage so far.


On Dec 19, 6:08 pm, "dr. Hannibal Lecter" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> can regular array_merge(...) do the trick for you?
>
> http://hr.php.net/array_merge

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to