title: PHP: remove element from multidimensional array (by key) using foreach
body: <p>I got multidimensional array. From each subarray, I would like to remove / unset values with index 1. My array $data.</p>
  
  <pre><code>Array
  (
      [3463] =&gt; Array
          (
              [0] =&gt; 1
              [1] =&gt; 2014
              [context] =&gt; 'aaa'
          )
  
      [3563] =&gt; Array
          (
              [0] =&gt; 12
              [1] =&gt; 2014
              [context] =&gt; 'aaa'
          )       
  
      [2421] =&gt; Array
          (
              [0] =&gt; 5
              [1] =&gt; 2014
              [context] =&gt; 'zzz'
          )               
  )
  </code></pre>
  
  <p>I would like to remove every element with index '1' from subarrays. Desired output is: </p>
  
  <pre><code>Array
  (
      [3463] =&gt; Array
          (
              [0] =&gt; 1
              [context] =&gt; 'aaa'
          )
  
      [3563] =&gt; Array
          (
              [0] =&gt; 12
              [context] =&gt; 'aaa'
          )       
  
      [2421] =&gt; Array
          (
              [0] =&gt; 5
              [context] =&gt; 'zzz'
          )               
  )
  </code></pre>
  
  <p>Why this does not work? </p>
  
  <pre><code>foreach ($data as $subArr) {
     foreach ($subArr as $key =&gt; $value) {
         if ($key == '1') {
          unset($subArr[$key]);
         }
  
     }
  }
  </code></pre>
  
  <p>I'm sorry if this problem is trivial for you guys.</p>