My XML
<properties>
<property>
<refno>001</refno>
<status>active</status>
<type>SP</type>
<description>Text Text Text</description>
<images>
<image>Path_here</image>
<image>Path_here</image>
<image>Path_here</image>
</images>
</property>
<property>
<refno>002</refno>
<status>active</status>
<type>SP</type>
<description>Text Text Text</description>
<images>
<image>Path_here</image>
<image>Path_here</image>
<image>Path_here</image>
</images>
</property>
</properties>
My PHP Code
if ($xml = simplexml_load_file($xml_file_here)) {
foreach($xml->property as $i) {
if ($i->refno == "1") {
echo $i->description."<br />".
echo $i->type;
}
}
}
I normally loop though the XML to find a [refno] value. Is there a way to search for value without the need to loop?