I have array like below
array(1) {
["data"]=>
array(6) {
[0]=>
array(2) {
["name"]=>
string(10) "Wang"
["id"]=>
string(9) "500011929"
}
[1]=>
array(2) {
["name"]=>
string(17) "Singh"
["id"]=>
string(9) "500033614"
}
[2]=>
array(2) {
["name"]=>
string(9) "Adam"
["id"]=>
string(9) "5014177"
}
[3]=>
array(2) {
["name"]=>
string(23) "Siva"
["id"]=>
string(9) "5036644"
}
[4]=>
array(2) {
["name"]=>
string(11) "Chu"
["id"]=>
string(9) "5044111"
}
[5]=>
array(2) {
["name"]=>
string(18) "Matta"
["id"]=>
string(9) "56657897"
}
}
}
I need to select randomly 2 value from this array I have tried with below code I am getting null.
$mylist = $facebook->api('/me/friends');
$rand_keys = array_rand($mylist , 2);
var_dump($mylist[$rand_keys[]]);
Please help me to solve this issue. Thanks in advance!