Facebook Graph API allows you to do amazing things with lot much code and hassle. For a Facebook app I was developing recently, I needed the list of mutual friends of two app users, to rank those higher who had higher mutual friends count, I wrote following function and worked like a charm. Just create the $facebook object by including the PHP SDK.
function get_mutual_friends($facebook, $uid1, $uid2){
try {
$mutualFriends = $facebook->api($uid1.'/mutualfriends/'.$uid2);
return $mutualFriends;
}
catch(Exception $o) {
print_r($o);
}
return '';
}
//call the function like this, of course after you have created $facebook object
$mutual_friends = get_mutual_friends($facebook, $friend_id1, $friend_id2);
//print all the array data like this
print_r($mutual_friends['data']);
Before you try this code, make sure that both of your friends have joined your app for which you are trying to get the list of mutual friends.
Hope that helps.
Cheers!