<?php $arr =[['c' => 3], ['a' => 1, 'b' => 2, 'c' => 3], ['c' => 3]]; $new = $arr[0]; foreach($arr as $sub){ $new = array_intersect_key($new, $sub); } foreach($arr as &$sub){ $sub =array_intersect_key($sub, $new); } Var_dump($arr);
You have javascript disabled. You will not be able to edit any code.