Beispiel #1
0
function buildXmlTree($var, &$xml)
{
    if (is_array($var)) {
        foreach ($var as $key => $value) {
            if (is_numeric($key)) {
                $key = "id_" . $key;
            }
            $xml .= "<{$key}>";
            $inner = buildXmlTree($value, $xml);
            $xml .= $inner . "</{$key}>\n";
        }
    } else {
        return xmlencode($var);
    }
}
Beispiel #2
0
function buildXmlTree($var, &$xml)
{
    if (is_array($var)) {
        foreach ($var as $key => $value) {
            $xml .= "<{$key}>" . buildXmlTree($value, $xml) . "</{$key}>\n";
        }
    } else {
        return xmlencode($var);
    }
}