title: Mapping an array in PHP with this array
body: <p>I have array as follows,</p>
  
  <pre><code>$arr['fixed_key'][0]['key1']['key2'] = 'y';
  $arr['fixed_key'][1]['key1']['key2'] = 'y';
  $arr['fixed_key'][2]['key1']['key2'] = 'n';
  $arr['fixed_key'][3]['key1']['key2'] = 'n';
  </code></pre>
  
  <p>I want to remove all arrays which have key2='n', I can traverse through array in a loop and achieve this, as follows:</p>
  
  <pre><code>$l=length($arr);
  for($i=0;$i&lt;$l;$i++) {
  
      if($arr['fixed_key'][$i]['key1']['key2'] == 'n') {
  
          unset($arr['fixed_key'][$i]['key1']['key2']);
  
      }
  
  }
  </code></pre>
  
  <p>My question is, is it possible to do this in better way, like array_map or array_walk, what is the best possible way?</p>