public function arrayToXml($arrayData = [])
    {
        $xml = '<?xml version="1.0" encoding="UTF-8"?>';
        $xml .= '<root>';
        foreach ($arrayData as $key => $value) {
            $xml .= '<xml_data>';
            if (is_array($value)) {
                foreach ($value as $k => $v) {
                    //$k holds the table column name
                    $xml .= "<$k>";
                    //embed the SQL data in a CDATA element to avoid XML entity issues
                    $xml .= "<![CDATA[$v]]>";
                    //and close the element
                    $xml .= "</$k>";
                }
            } else {
                //$key holds the table column name
                $xml .= "<$key>";
                //embed the SQL data in a CDATA element to avoid XML entity issues
                $xml .= "<![CDATA[$value]]>";
                //and close the element
                $xml .= "</$key>";
            }
            $xml .= '</xml_data>';
        }
        $xml .= '</root>';

        return $xml;
    }
public function arrayToXml($arrayData = [])
    {
        $xml = '<?xml version="1.0" encoding="UTF-8"?>';
        $xml .= '<root>';
        foreach ($arrayData as $key => $value) {
            $xml .= '<xml_data>';
            if (is_array($value)) {
                foreach ($value as $k => $v) {
                    //$k holds the table column name
                    $xml .= "<$k>";
                    //embed the SQL data in a CDATA element to avoid XML entity issues
                    $xml .= "<![CDATA[$v]]>";
                    //and close the element
                    $xml .= "</$k>";
                }
            } else {
                //$key holds the table column name
                $xml .= "<$key>";
                //embed the SQL data in a CDATA element to avoid XML entity issues
                $xml .= "<![CDATA[$value]]>";
                //and close the element
                $xml .= "</$key>";
            }
            $xml .= '</xml_data>';
        }
        $xml .= '</root>';

        return $xml;
    }
public function arrayToXml ( $ arrayData = [ ] ) { $ xml = '<?xml version="1.0" encoding="UTF-8"?>' ; $ xml .= '<root>' ; foreach ( $ arrayData as $ key => $ value ) { $ xml .= '<xml_data>' ; if ( is_array ( $ value ) ) { foreach ( $ value as $ k => $ v ) { //$k holds the table column name $ xml .= "<$k>" ; //embed the SQL data in a CDATA element to avoid XML entity issues $ xml .= "<![CDATA[$v]]>" ; //and close the element $ xml .= "</$k>" ; } } else { //$key holds the table column name $ xml .= "<$key>" ; //embed the SQL data in a CDATA element to avoid XML entity issues $ xml .= "<![CDATA[$value]]>" ; //and close the element $ xml .= "</$key>" ; } $ xml .= '</xml_data>' ; } $ xml .= '</root>' ; return $ xml ; }
function definition to convert array to xml
send an array and get xml.

@param array $arrayData

@return string
function definition to convert array to xml send an array and get xml .