title: Compare Dynamic Multidimensional Arrays
body: <p>I have two multidimensional dynamic arrays like so in PHP:</p>
  
  <pre><code>$old = array(
  "meta_data" =&gt; array(
          "page_title" =&gt; "Test1",
          "page_description" =&gt; "Test2",
          "page_keywords" =&gt; "Test3"
      ),
  
  "content" =&gt; array(
          "page_header_one" =&gt; "1",
          "page_content_one" =&gt; "2",
          "page_header_two" =&gt; "3",
          "page_content_two" =&gt; "4",
          "page_header_three" =&gt; "5"
      ),
  );
  
  $new = array(
  "meta_data" =&gt; array(
          "page_title" =&gt; "Test1",
          "page_description" =&gt; "Test2",
          "page_keywords" =&gt; "Test3324"
      ),
  
  "content" =&gt; array(
          "page_header_one" =&gt; "124",
          "page_content_one" =&gt; "243",
          "page_header_two" =&gt; "343"
      ),
  );
  </code></pre>
  
  <p>I'm struggling to compare these as they're dynamic, e.g. the keys change. What I'm aiming to do is compare the arrays, find out what's changed, leave out keys that don't match, and only add the changes to the new array. </p>
  
  <p>The only things that will be constant are "meta_data" and "content"</p>
  
  <p>So for example in <code>$old</code> we have 5 items in the content array, but in the <code>$new</code> array we only have 3 items (3 changed items), so the new array would have 3 content items.</p>
  
  <p>Is there a way to do this I can't for the life in me figure out how?</p>
  
  <p>Final array should look like so:</p>
  
  <pre><code>$final = array(
  "meta_data" =&gt; array(
          "page_keywords" =&gt; "Test3324"
      ),
  
  "content" =&gt; array(
          "page_header_one" =&gt; "124",
          "page_content_one" =&gt; "243",
          "page_header_two" =&gt; "343"
      ),
  );
  </code></pre>