When I try to access info that is not presented in xml like so: $someInfo = $element->blabla->cats[0]->src;
PHP shows notice like this: Notice: Trying to get property of non-object
How would I settle the matter?
When I try to access info that is not presented in xml like so:
Share
Either
$element,blabla, orcats[0]is not an object, and thus can’t contain any elements.Use
isset():one
isset()should do, no need to check every part consecutively.This should do the job even if
catsexists but is not an array.