- simplexml_load_string: documentation ( source)
<?php
$string = <<<XML
<veh>
<a>
<foo name="one" game="lonely">1</foo>
<foo name="two" game="wow">2</foo>
</a>
</veh>
XML;
//$xml = simplexml_load_string($string);
//var_dump($xml->a);exit;
$xml = simplexml_load_string($string);
foreach($xml->foo[0]->attributes() as $a => $b) {
echo $a,'="',$b,"\"\n";
}
?>