How to convert xml into array in php?

前端 未结 9 1347
半阙折子戏
半阙折子戏 2020-11-22 02:54

I want to convert below XML to PHP array. Any suggestions on how I can do this?


   
     
       

        
9条回答
  •  悲哀的现实
    2020-11-22 03:19

    easy!

    $xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
    $json = json_encode($xml);
    $array = json_decode($json,TRUE);
    

提交回复
热议问题