$arr = [];
function TreeToArray($tree,&$arr){
foreach ($tree as $key => &$value){
if(!empty($value['child'])) TreeToArray($value['child'], $arr); # 有儿子就删儿子
unset($value['child']);
$arr[] = $value; # 这算是叶子结点,把值保存下来,
unset($value); #保存完之后,就整体删除
}
}
TreeToArray($tree,$arr);
print_r($arr);