title: Compare Two Arrays based on key value
body: <p>I'm working on a Quiz engine and am comparing answers.</p>
  
  <p>I have two arrays </p>
  
  <p>correct answers :</p>
  
  <pre><code> 0 =&gt; "a"
   1 =&gt; "a"
   2 =&gt; "a"
   3 =&gt; "c"
  </code></pre>
  
  <p>Chosen Answers...</p>
  
  <pre><code> 0 =&gt; "c"
   1 =&gt; "b"
   2 =&gt; "a"
   3 =&gt; "b"
  </code></pre>
  
  <p>So based on this, I know (from comparing myself) that I have 1 correct answer.</p>
  
  <p>Is there a PHP function that can compare the keys and the values and increment a number of similar?</p>
  
  <p>I've looked at array_intersect and array_difference but they don't seem to give me the desired answer.</p>
  
  <p>Thanks</p>