I am getting the contents of a facebook api call that will return all the posts made to a facebook group. So all the posts/comments on that post.
$data = json_decode(file_get_contents($url2));
foreach($data as $post){
foreach $post as $subpost)
{
...etc
}
}
The problem I have here is that I will need to use 3 nested foreach loops in order to actually get the data I want. How do I get the first element of $data without having to use a foreach?
e.g. something like $data[0] (which doesn't work). How does a foreach loop iterate through an object so I can just manually write it since I only want 1 single object thats nested inside arrays.
edit object(stdClass)#1 (2) { ["data"]=> array(25) { [0]=> object(stdClass)#2 (10)...
i want to access the final object that contains 10 pieces of data.
var_dump($data)json_decode($return_value, true), to make it an array if objects bothers you