I have tried the following:
$tree['uid1']['page'] = "page1";
$tree['uid1']['childs']['uid2']['page'] = "page2";
$tree['uid1']['childs']['uid3']['page'] = "page3";
array_walk_recursive($tree, function (&$item, $key) {
echo $key.', ';
if ($key == 'uid3') {
// push array('childs' => array('uid4' => array('page' => 'page4')))
}
});
But echo $key.', '; only returns me the last key ("page") Have I done something wrong or have I misunderstood the function "array_walk_recursive"