I'm trying to access third party api which gives me object and sub object, for example:
stdClass Object
(
[truncated] =>
[text] => "some text"
[user] => stdClass Object
(
[count] => 9370
[comments_enabled] => yes
When I try and loop through the object with the following code I get an error at the start of sub-object 'user'. Can anyone help me either 1) iterate through the sub-object, or 2) block the sub-object from the loop.
The code:
$test = $s[0];
$obj = new ArrayObject($test);
foreach ($obj as $data => $name) {
print $data . ' - ' . $name . '<br />';
}
thanks