PHP code snippet – How to get attribute value in xml ?
$xml=simplexml_load_file($file); foreach($xml->Var[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } $attr = $xml->Var[0]->attributes(); echo $attr['my_var'];
$xml=simplexml_load_file($file); foreach($xml->Var[0]->attributes() as $a => $b) { echo $a,'="',$b,"\"\n"; } $attr = $xml->Var[0]->attributes(); echo $attr['my_var'];