how to randomize a Facebook friend in PHP? -


i trying randomize facebook friend firend list.

since new php, can assist me , let me know how so?

$friends_json = file_get_contents('https://graph.facebook.com/me/friends?access_token='.$session["access_token"]); $friends = json_decode($friends_json, true); $friend_rand = array_rand($friends, 1); // <-- right? how can print on screen? 

array_rand returns array of keys. since you're extracting 1 element code print is

echo($friend_rand[0]); 

andrea's answer works well, print array (not element).


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -