PHP code example of openlss / lib-array2xml

1. Go to this page and download the library: Download openlss/lib-array2xml library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.

/* Start to develop here. Best regards */


openlss / lib-array2xml example snippets

//create XML
$xml = Array2XML::createXML('root_node_name', $php_array);
echo $xml->saveXML();

//create Array
$array = XML2Array::createArray($xml);

// Build the array that should be transformed into a XML object.
$array = [
    'title' => 'A title',
    'body' => [
        '@xml' => '<html><body><p>The content for the news item</p></body></html>',

// Use the Array2XML object to transform it.
$xml = Array2XML::createXML('news', $array);
echo $xml->saveXML();