I have two xml files with a similar structure, and I need to merge them based on a common attribute. To be more explicit, here are two samples:
file1.xml
You can use the attribute() function of SimpleXML
$xml = simplexml_load_file($filename); foreach($xml->Products->record->attributes() as $attribute => $value) { //do something }