Hi all,
I have an array of objects that looks like this:
object(stdClass)[2]
public 'statuses' =>
array (size=97)
0 =>
object(stdClass)[3]
public 'metadata' =>
object(stdClass)[4]
public 'iso_language_code' => string 'en' (length=2)
public 'id' => int 700797209428668416
1 => ...
n => ...
I a simply trying to iterate through the array of objects and access the 'id' property. The code I am using is:
foreach($obj_array as $statuses)
{
foreach($statuses as $s)
{
//Store all IDs in Array
$id_array[] = $s->id;
}
}
However, I am getting the error: Undefined property: stdClass::$id
I'm very new to working with classes, so I suspect I've just fundementally mis-understood how the data is structured.
I thought the 'id' property may be a property of 'metadata' but even $id_array[] = $s->metadata->id;
gave me the same error.
Any help would be appreciated!