PHP 多维数组删除某字段或某几个字段
<?php
$array = array( '0' => array('a' => 'aaaaa', 'b' => 'bbbbb', 'c' => array('d' => 'ddddd', 'e' => 'eeeee')),
'1' => array('a' => 'aaaaa', 'b' => 'bbbbb', 'c' => array('d' => 'ddddd', 'e' => 'eeeee')));
$keys = array('c');
function array_remove_key($array,$keys){
if (!is_array($array) || !is_array($keys)){
return false;
}
foreach($array as $t){
foreach($keys as $k){
unset($t[$k]);
}
$doc[]=$t;
}
return $doc;
}
$doc=array_remove_key($array,$keys);
print_r($doc);
?>