Table of Contents
/**
* Convert an array to XML
* @param array $array
* @param SimpleXMLElement $xml
*/
function arrayToXml($array, &$xml){
foreach ($array as $key => $value) {
if(is_array($value)){
if(is_int($key)){
$key = "e";
}
$label = $xml->addChild($key);
$this->arrayToXml($value, $label);
}
else {
$xml->addChild($key, $value);
}
}
}
// $xml = new SimpleXMLElement('<root/>');
// array_walk_recursive($arr1, array ($xml, 'addChild'));
// print $xml->asXML();