Finding matches in two arrays

I have two arrays. I need to find the ones that match and the ones that don’t match.

Array 1 has about 2000 records
Array 2 has about 7000 records

How could I find the keys of the arrays from Array 1 that match Array 2 and the ones that don’t match?

I tried a combination of things, but they don’t seem to be very accurate and I run into different problems. I was doing something like this


while($row=mysql_fetch_array($result))
{
   $i=0;
   foreach($array2 as $key => $value)
   {
      if($array2['something']==$row['something'])
      {
            // it's a match!
       }
       elseif(count($array2)==$i)
       {
           // not a match
           $i=0;
        }
   $i++;
   }
}

Thanks in advance :hr: