PHP code example of multidimensional / dom-array

1. Go to this page and download the library: Download multidimensional/dom-array library. Choose the download type require.

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

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

multidimensional / dom-array example snippets


use Multidimensional\DomArray\DOMArray;

$dom = new DOMArray('1.0', 'utf-8');
$array = ['item' => ['subitem' => 'true', '@id' => '123']];
$dom->loadArray($array);
$xml = $dom->saveXML();

echo $xml;

/*  <?xml version="1.0" encoding="utf-8"