我想尝试只通过array_push将填充的行带到另一个数组但是我不能动态地采用它们,因为第一个索引是字符串,我该怎么做呢?感谢。
<?php
while($i < count($val['error']){
if($val['error'][$i] === 0)
{
array_push($newarray, $val[whatwilliputherebecauseofstringindex][$i]);
}
}
?>
答案 0 :(得分:0)
<?php
// get keys of original array (name, type, etc..)
$keys = array_keys($array);
// for each error value ...
foreach ($array['error'] as $key => $val) {
// if error is not 0..
if($val !== 0)
{
// for each key in the original array..
foreach ($keys as $k) {
// unset the element of the same iteration
unset($array[$k][$key]);
}
}
}
?>