php将XML转成数组

$xmlstring = <<

乐杨俊
php将XML转成数组
BJ
乐杨俊php相关浅谈!

XML;


$xml = simplexml_load_string($xmlstring);
$data['info'] = json_decode(json_encode($xml),TRUE);
echo "
";
print_r($data);
foreach($data as $values){
foreach($values as $dv){
echo $dv."\n";
}
}

你可能感兴趣的:(PHP)