Possible Duplicate:
Find common values in multiple arrays with PHP
I'm trying to find the number of friends two users have in common. Each users friends user id's are stored in the data base like this: 12, 13, 14. This is my code.
$my_friends = explode(',', $my_friends);
print_r($my_friends);
This outputs: Array ( [0] => 12 [1] => 13 [2] => 14 )
These are my friends user id's. Now for the next user:
$users_friends = explode(',', $users_friends);
print_r($users_friends);
This outputs: Array ( [0] => 12 )
How do I show that user 1 and user 2 have id 12 in common ?