从第一个索引是字符串的多维数组中获取填充行


Taking filled rows from multidimmensional array which first index is string

我想尝试通过array_push仅将填充行带到另一个数组,但我无法动态获取它们,因为第一个索引是字符串,我怎样才能正确地做到这一点?谢谢。

<?php
 while($i < count($val['error']){
  if($val['error'][$i] === 0)
  {
   array_push($newarray, $val[whatwilliputherebecauseofstringindex][$i]);
  }
 }
?>

嗨,这里是糊状物

<?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]);
    }
  }
}
?>