3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = <<< EOT <?xml version='1.0' encoding='UTF-8'?> <eveapi version="2"> <currentTime>2013-10-01 18:00:01</currentTime> <result> <rowset name="members" key="characterID" columns="characterID, name"> <row characterID="2234" name="Bob"> <format type="test">Bob format</format> </row> <row characterID="555" name="John">test1 <format type="test">John format</format> </row> </rowset> </result> <cachedUntil>2013-10-01 18:57:01</cachedUntil> </eveapi> EOT; $simpleXML = simplexml_load_string($xml); // Load XML string data into the simplexml object parser foreach ($simpleXML->result->rowset as $rowset) { foreach ($rowset->row as $row) { $titles = []; echo "cp "; print_r($row->format); echo " cp "; $name = $row['name']->__toString(); foreach($row as $attrib){ if($attrib['name']->__toString() === 'titles'){ foreach($attrib as $title){ $titles[] = $title['titleName']->__toString(); } } } echo $name . ' : ' . implode(' - ', $titles) . "<br/>\n"; } }

preferences:
33.61 ms | 402 KiB | 5 Q