title: How can I get the duplicate multidimensional array in php
body: <p>I have an multidimensional array:</p>
  
  <pre><code>   Array
  (
      [0] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 2
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
      [1] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 5
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
      [2] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 2
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
  )
  </code></pre>
  
  <p>Look at the first index (or zero) and third index (number two index), the values in a,b,c,d is equal 1,2,3,4. Assuming that the array is equal, or no different of them; my question is, how can I catch the array which equal, my purpose to show users about the value input duplicate, </p>
  
  <p>I have already been using <code>array_unique</code>. This is the result : </p>
  
  <pre><code>    Array
  (
      [0] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 2
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
      [1] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 5
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
  )
  </code></pre>
  
  <p>But I just want to get duplicate data, not remove the data duplicate.</p>
  
  <pre><code>// first : get all data, if the data same / duplicate take only one data
  
  $unique = array_unique($data, SORT_REGULAR);
  
  // then, get the data which duplicate with
  
  $diffCellUniq = array_diff_key($data, $unique);
  
  // so print the result 
  
  print_r($diffCellUniq); exit;
  
  
  
     Array
  (
      [2] =&gt; Array
          (
              [a] =&gt; 1
              [b] =&gt; 2
              [c] =&gt; 3
              [d] =&gt; 4
          )
  
  )
  </code></pre>