我有以下二维数组:
Array ( [0] =>
Array ( [0] => 20130202
[1] => unknown
[2] => 0
[3] => 1
[4] => 0
[5] => 0
[6] => 0
[7] => 19022
[8] => 0
[9] => 0 )
[1] =>
Array ([0] => 20130202
[1] => ZZ
[2] => 1
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 4
[8] => 0
[9] => 0 )
*
*
我尝试删除内部数组上的特定以下条目:2、4、6、7、8、9。我正在使用的代码如下:
foreach ($array_with_values as $key => $obj) {
if ($key == 2 || $key == 4 || $key == 6 || $key == 7 || $key == 8 || $key == 9){
unset($obj[$key]);
}
}
但它不起作用。有任何想法吗?