title: Compare two multidimensional array and get data by value in php
body: <p>I have two multidimensional array</p>
  
  <pre><code>// Array 1
  Array
  (
      [0] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/heythere.jpg
              [source] =&gt; database
          )
  
      [1] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/test.jpg
              [source] =&gt; database
          )
  
  );
  
  // Array 2
  Array
  (
      [0] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/heythere.jpg
              [source] =&gt; directory
          )
  
      [1] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/demo.jpg
              [source] =&gt; directory
          )
  
      [2] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/image.jpg
              [source] =&gt; directory
          )
  
  );
  </code></pre>
  
  <p>There is similar data in both the arrays like;
  /wp-content/uploads/2019/09/heythere.jpg</p>
  
  <p>I want to merge these two arrays in one but only unique elements by value also I need to get the element of Array1 if the values are same</p>
  
  <p>So after merging two array I want this result:</p>
  
  <pre><code>Array
  (
  
      [0] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/demo.jpg
              [source] =&gt; directory
          )
  
      [1] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/image.jpg
              [source] =&gt; directory
          )
  
      [2] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/heythere.jpg
              [source] =&gt; database
          )
  
      [3] =&gt; Array
          (
              [src] =&gt; /wp-content/uploads/2019/09/test.jpg
              [source] =&gt; database
          )
  
  
  );
  </code></pre>
  
  <p>It will skip "directory" similar element.</p>