PHP array compare issue
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5513121/is-there-any-way-to-get-common-values-between-two-arrays-in-php">is there any way to get common values between two arrays in php?</a>  </p>
</blockquote>



<p>I am trying to compare 2 <code>arrays</code> and keep the elements based on the second <code>array</code>.</p>

<p>I have</p>

<pre><code>array 1

array('3' =&gt; 'test1', '4' =&gt; 'test2', '1' =&gt;'test3')



array 2

array('2' =&gt;'test2', '3' =&gt;'test3')
</code></pre>

<p>I want to compare <code>array 1</code> and <code>array 2</code> and keep the test 2 and test 3 in <code>array 1</code> in my case.</p>

<p>So the end result will be</p>

<pre><code>array('4' =&gt; 'test2', '1' =&gt;'test3')
</code></pre>

<p>I have tried <code>array_diff</code> but it doesn't come out the results I wanted. I also google for a while but coudln't find anything useful either.</p>

<p>Are there anyways to get what I need? Thanks a lot!</p>
