📅  最后修改于: 2022-03-11 14:53:37.625000             🧑  作者: Mango
print_r(deep_delete_keys($arr,'country'));
function deep_delete_keys($arr, $keys) {
if (!is_array($keys)) $keys = array($keys);
$filteredArr = array_diff_key( $arr, array_flip( $keys ) );
foreach ($filteredArr as &$val) {
if (is_array($val)) {
$val = deep_delete_keys($val, $keys);
}
}
return $filteredArr;
}