Ciao a tutti ragassuoli.
Vi posto il codice di una funzione ricorsiva che consente di trasformare un array in PHP in un documento XML mantendo anche una identazione leggibile.
Spero possa essere considerata come pillola 
Ecco qui
codice:
function ArrayToXML($array, $deep = 1) {
foreach ($array as $key => $value) {
$indent = str_repeat("\t", $deep);
if (!is_array($value)) {
$xmlstr .= $indent . "<". $key .">\n";
$xmlstr .= $indent . "\t<![CDATA[". $value ."]]>\n";
$xmlstr .= $indent . "</". $key .">\n";
}
else {
$currentkey = $key;
$xmlstr .= $indent . "<". $currentkey .">\n";
$xmlstr .= ArrayToXML($value, ++$deep);
$xmlstr .= $indent . "</". $currentkey .">\n";
}
}
return $xmlstr;
}
echo ArrayToXML($array_qualunque);
spero possa tornarvi utile...
P.s. Se volete vedere l'output o fate stampare il risultato dentro una textarea oppure inviate un header(Content-type: text/xml)... ok??
Ciao