title: Check the 'form' of a multidimensional array for validation
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3876435/recursive-array-diff">recursive array_diff()?</a>  </p>
  </blockquote>
  
  
  
  <p>I have a static multidimensional array which is always going to be in the same form. E.g. it will have the same keys &amp; hierarchy.</p>
  
  <p>I want to check a posted array to be in the same 'form' as this static array and if not error.</p>
  
  <p>I have been trying various methods but they all seem to end up with a lot of if...else components and are rather messy.</p>
  
  <p>Is there a succinct way to achieve this?</p>
  
  <hr>
  
  <p>In response to an answer from dfsq:</p>
  
  <pre><code>$etalon = array(
      'name' =&gt; array(),
      'income' =&gt; array(
          'day'   =&gt; '',
          'month' =&gt; array(),
          'year'  =&gt; array()
      ),
      'message' =&gt; array(),
  );
  
  $test = array(
      'name' =&gt; array(),
      'income' =&gt; array(
          'day'   =&gt; '',
          'month' =&gt; array(),
          'year'  =&gt; array()
      ),
      'message' =&gt; array(),
  );
  
  // Tests
  $diff = array_diff_key_recursive($etalon, $test);
  var_dump(empty($diff));
  print_r($diff);
  </code></pre>
  
  <p>And the results from that are</p>
  
  <pre><code>bool(false) 
  Array ( [name] =&gt; 1 [income] =&gt; Array ( [month] =&gt; 1 [year] =&gt; 1 ) [message] =&gt; 1 ) 
  </code></pre>