title: Compare values from three arrays PHP?
body: <p>I have a maybe stupid question?</p>
  
  <p>I have three arrays. And I want to get different values from the first and third array. I created the following code but the returned values are wrong.</p>
  
  <pre><code>function ec($str){
      echo $str.'&lt;br&gt;';
  }
  
  $arr1 = array( array(
                      'letter' =&gt; 'A',
                      'number' =&gt; '1'
                  ),
  
                 array(
                      'letter' =&gt; 'B',
                      'number' =&gt; '2'
                  ),
  
                 array(
                      'letter' =&gt; 'C',
                      'number' =&gt; '3'
                  )
  
      );
  
  $arr2 = array( array(
                      'letter' =&gt; 'A',
                      'number' =&gt; '1'
                  ),
  
                 array(
                      'letter' =&gt; 'B',
                      'number' =&gt; '2'
                  )
  
      );
  
  
  
   $arr3 = array( array(
                      'letter' =&gt; 'D',
                      'number' =&gt; '4'
                  ),
  
                 array(
                      'letter' =&gt; 'E',
                      'number' =&gt; '5'
                  )
  
      );
  
      $mergeArr = array_merge($arr1,$arr3);
      foreach ($mergeArr as $kMerge =&gt; $vMerge){
          foreach ($arr2 as $val2){
              if($val2['letter'] != $mergeArr[$kMerge]['letter']){
                  ec($mergeArr[$kMerge]['letter']);
              }
          }
      }
  </code></pre>
  
  <p>The result of this code is:</p>
  
  <pre><code>A
  B
  C
  C
  D
  D
  E
  E
  </code></pre>
  
  <p>The result I want:</p>
  
  <pre><code>    C
      D
      E
  </code></pre>
  
  <p>Thanks in advance.</p>