PHP array comparison and finding matched and non matched items
<p>I have been using this script for finding matched and nonmatched array items.</p>

<p>My code is.</p>

<pre><code>$filter1 = "red,green,blue,yellow";         
$parts1 = explode(',', $filter1);

$filter2 = "red,green,blue";        
$parts2 = explode(',', $filter2);

for($i=0; $i&lt; count($parts1); $i++)
{

    for($j=0; $j&lt; count($parts2); $j++)
    {

        if($parts1[$i] == $parts2[$j])
        {
            $match[] = $parts1[$i];
        } else {
            $nomatch[] = $parts1[$i];
        }
    }
}

print_r($match);
echo "&lt;br&gt;";
print_r($nomatch);
</code></pre>

<p>By using this code i am only getting the matched items and not nonmatched. Can anybody help.
Thanks in advance.</p>
