php array to xml using recurrsion
===

I would like my function to convert array of dimension N to xml, but it doesn't work.
Anyone can point me in the right direction?

    function arrayToXml($array,$render = ""){
    if(!is_array($array)){
        return $array;
    }
    foreach ($array as $key => $value) {
        if(is_array($value)){
            $render .= '<' . $key . '>';
            arrayToXml($value,$render);
        }
        else {
            $render .= '<' . $key . '>';
            $render .= $value;
            $render .=  '</' . $key . '>';
        }
    }
    return $render;
}