I'm having some trouble dealing with stdClass object inside a stdClass object inside an array. I am trying to get the 'Source' value from this. I've tried this several different ways to no avail. It's entirely likely that I'm missing something embarrassingly simple...
$result =
Array ( [0] => stdClass Object ( [url] => stdClass Object ( [Source] => http://someurl.com/someimage.JPG ) ) )
$imgurl = $result->URL->Source;
I've also tried:
$object = $result[0];
$imgurl = $object->url->Source;
and in both cases
Server Error:
PHP Notice: Trying to get property of non-object
Ok, so the server error tells me that the array is not an object, which made sense before we broke out the $object, but still receiving this same error. I've also tried combining this with an array_values function, but get the same error. I've also tried get_object_vars and array_keys functions...
So how do I get the value of an object, inside an object, that's inside an array?
Thanks in advance.
stdClass Objects inside Objects in an Array
Moderator: General Moderators