xml php array to xml code example
Example 1: php xml to array
public function xmlToArray($xmlstring){
$xml = simplexml_load_string($xmlstring, "SimpleXMLElement", LIBXML_NOCDATA);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
return $array;
}
Example 2: convert xml file to array php
$xmlfile = file_get_contents($path);
$ob= simplexml_load_string($xmlfile);
$json = json_encode($ob);
$configData = json_decode($json, true);