i want to show a random friend to user who uses my application.I have neccesarry permission to get all friends but can't show random friend(s)
Can you give me a code for this please.
Thanks
$friends = array("Mitch", "Dave", "Charlie", "Tom");
$rand_keys = array_rand($friends, 1);
echo $friends[$rand_keys[0]] . "\n";
echo $friends[$rand_keys[1]] . "\n"; ?>
You can pull back a JSON of fbuids of each friend, JSON decode it, then use array_rand to pull out a random one
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.