这是我的数组:
array(
[0] => Array (
[field_type] => title
[_id] => 4d143e6 )
[1] => Array (
[field_type] => title
[_id] => 89ff3a3 )
);
如何从此数组中删除_id键。请帮助
答案 0 :(得分:3)
<?php
$arr = [
[
'field_type' => 'Title',
'_id' => 1
],
[
'field_type' => 'Title',
'_id' => 2
]
];
// Pass by reference to allow array mutation
foreach($arr as &$a)
{
unset($a['_id']);
}
print_r($arr);