为什么我不能取消关联数组中的数组 php

Why I can not unset array in associative array php

为什么我不能取消关联数组中的数组 php 我看到了转储,但我也在最终数组中看到了未设置的数组

foreach($dossier['program'] as $program){
    foreach($program['cities'] as $city){
        foreach($city['services'] as $service){
            foreach($service['featureds'] as $key=>$featured){
                dump($key);
                if($key!==(int)$quotation_conditions['groups']){
                    dump($service['featureds'][(string)$key]);
                    unset($service['featureds'][(string)$key]);
                }
            }
        }
    }
}
dd($dossier);

试试这个

foreach($dossier['program'] as &$program){
    foreach($program['cities'] as &$city){
        foreach($city['services'] as &$service){
            foreach($service['featureds'] as $key=>$featured){
                dump($key);
                if($key!==(int)$dossier['groups']){
                    dump($service['featureds'][(string)$key]);
                    unset($service['featureds'][(string)$key]);
                }
            }
        }
    }
}