I think this can be done with something like http://ca3.php.net/manual/en/function.array-diff-key.php without $result or looping here.