How to convert xml into array in php?

前端 未结 9 1334
半阙折子戏
半阙折子戏 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:20

    I liked this question and some answers was helpful to me, but i need to convert the xml to one domination array, so i will post my solution maybe someone need it later:

    $value){
            if(!is_array($value)){
                $finalItem[$key] = $value;
            }else{
                $finalItem = getChild($value, $finalItem);
            }
        }
        return $finalItem;
    }
    ?>  
    

提交回复
热议问题