private static function generateXmlFromArray($array, $node_name) 
    {
        $xml = '';

        if (is_array($array) || is_object($array)) {
            foreach ($array as $key=>$value) {
                if (is_numeric($key)) {
                    $key = $node_name;
                }

                $xml .= '<' . $key . '>' . self::generateXmlFromArray($value, $node_name) . '</' . $key . '>';
            }
        } else {
            $xml = htmlspecialchars($array, ENT_QUOTES);
        }

        return $xml;
    }
private static function generateXmlFromArray($array, $node_name) 
    {
        $xml = '';

        if (is_array($array) || is_object($array)) {
            foreach ($array as $key=>$value) {
                if (is_numeric($key)) {
                    $key = $node_name;
                }

                $xml .= '<' . $key . '>' . self::generateXmlFromArray($value, $node_name) . '</' . $key . '>';
            }
        } else {
            $xml = htmlspecialchars($array, ENT_QUOTES);
        }

        return $xml;
    }
private static function generateXmlFromArray ( $ array , $ node_name ) { $ xml = '' ; if ( is_array ( $ array ) || is_object ( $ array ) ) { foreach ( $ array as $ key => $ value ) { if ( is_numeric ( $ key ) ) { $ key = $ node_name ; } $ xml .= '<' . $ key . '>' . self :: generateXmlFromArray ( $ value , $ node_name ) . '</' . $ key . '>' ; } } else { $ xml = htmlspecialchars ( $ array , ENT_QUOTES ) ; } return $ xml ; }
Generate XML from array

@param array $array
@param string $node_name
@return string
Generate XML from array