title: comparing two arrays in php
body: <p>I use this code :</p>
  
  <pre><code> $new = array(
       "123" =&gt; "a",
       "456" =&gt; "b"
   );
  
   $old = array(
       "123" =&gt; "a",
       "456" =&gt; "b"
   );
  </code></pre>
  
  <p>then the <code>$new</code> array become like this:</p>
  
  <pre><code> $new = array(
       "456" =&gt; "b",
       "123" =&gt; "c",
       "789" =&gt; "e"
   );
  </code></pre>
  
  <p>as you see the count of <code>$new</code> array increased and the order of elements changed and the value at key <code>123</code> also changed. I need to compare the <code>$new</code> array against the <code>$old</code> array and catch only the change made on the value at key <code>123</code> without caring about the order and the count of elements. I tried:</p>
  
  <pre><code> $result = array_diff( $new, $old );
   print_r( $result );
  </code></pre>
  
  <p>output :</p>
  
  <pre><code> Array ( [123] =&gt; c [789] =&gt; e )
  </code></pre>