I am trying to get all the facebook group members ids with facebook php sdk, I am getting an array, and can't get out of the array with only ids.
Here is my array:
Array
(
[data] => Array
(
[0] => stdClass Object
(
[name] => Name Surname
[administrator] =>
[id] => 655330041265756
)
[1] => stdClass Object
(
[name] => Name Surname2
[administrator] =>
[id] => 10206563909924840
)
[2] => stdClass Object
(
[name] => Name Surname3
[administrator] =>
[id] => 1035931373098451
)
I am trying to export only [id]
, how is this possible?
Just a simple foreach can be used to iterate through the array and extract the id from each object.
foreach ($array as $key=>$value) {
echo $value->id;
}
Edit: If you want to assign the ids to an array, use the following code:
foreach ($array as $key=>$value) {
$idArray[] = $value->id;
}
Where $idArray is your array of ids.