Selecting attribute values based on another attribute value with SimpleXML [duplicate]
问题 This question already has answers here : SimpleXML: Selecting Elements Which Have A Certain Attribute Value (2 answers) Closed 6 years ago . I'm trying to display an image using an xml file and SimpleXML The XML code is <icons> <icon size="tiny" href="/FF02-tiny.jpg" /> <icon size="sidebar" href="/FF02-sidebar.jpg" /> <icon size="full" href="/FF02-full.jpg" /> </icons> I want to get the href attribute for the size="full" line. I've tried icons->icon->attributes()->href but this just gives me