Return to Snippet

Revision: 70086
at November 19, 2015 05:54 by kavikms

Initial Code
// function to convert xml to php array
function xml2Array($filename)
    $xml = simplexml_load_file($filename, "SimpleXMLElement", LIBXML_NOCDATA);
    $json = json_encode($xml);
    return json_decode($json,TRUE);

// function callback
$arr = xml2Array("Data.xml");

Initial URL

Initial Description
Convert easily XML File or String to Associative Array in PHP

Initial Title
Convert XML to Array in PHP

Initial Tags
php, array, xml

Initial Language