title: php multi-dimensional array remove duplicate
body: <p>Not sure if this question is a duplicate in need of removal, but I couldn't find the answer elsewhere so I'll have a go at asking.</p>
  
  <p>I've got a 2d array that looks as follows:</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [0] =&gt; dave
          [1] =&gt; jones
          [2] =&gt; c@b.c
      )
  
  [1] =&gt; Array
      (
          [0] =&gt; john
          [1] =&gt; jones
          [2] =&gt; a@b.c
  
      )
  
  [2] =&gt; Array
      (
          [0] =&gt; bruce
          [1] =&gt; finkle
          [2] =&gt; c@b.c
      )
  )
  </code></pre>
  
  <p>I'd like to remove those with duplicate emails. So in the above example I'd like to just remove either [][0] or [][2]. I'm not worried about checking against names or anything like that, I just need the sub arrays to be deduplicated based on a single value.</p>
  
  <p>At the moment I have something like this</p>
  
  <pre><code>  if(is_array($array) &amp;&amp; count($array)&gt;0){
    foreach ($array as $subarray) {
      $duplicateEmail[$subarray[2]] = isset($duplicateEmail[$subarray[2]]);
      unset($duplicateEmail[$subarray[2]]);
     }
    }
  </code></pre>
  
  <p>but it just ain't right. Any help appreciated.</p>