php SimpleXML check if a child exists

It might be better to wrap this in an isset()

if(isset($A->b->c)) { // c exists

That way if $A or $A->b don’t exist… it doesn’t blow up.

Leave a Comment