Question: Using Facebook graph API, I am trying to retrieve number of mutual friends 2 users have. However, I am getting number of friends of one of them instead.

Here is my code:

```
    <?php

    $mutual_array = json_decode(file_get_contents("https://graph.facebook.com/".$fb_id."/mutualfriends/".$other_fb_id."?".$access_token), true);

    $mutual_friends = $mutual_array['data'];
    $mutual_number = count($mutual_friends);

    ?>

```

$mutual\_number gives the number of facebook friends $other\_fb\_id user has. And when I try to print\_r $mutual\_friends it gives all the friends the user has.

Anyone know what's going on here? Thanks.

Answer: 
The answer is simple. The only thing you do is to change the order of placing your facebook id and friend's facebook id:

```
$mutual_array = json_decode(file_get_contents("https://graph.facebook.com/".$other_fb_id."/mutualfriends/".$fb_id."?".$access_token), true);

```
With graph api it's done by requesting :

me/mutualfriends?user=SOME\_USER\_ID

if you and the SOME\_USER\_ID have mutualfriends you get the list of friends.