PHP code example of fracalo / arr2xml

1. Go to this page and download the library: Download fracalo/arr2xml 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/ */

    

fracalo / arr2xml example snippets


use Fracalo\Arr2Xml\Arr2Xml;

$payload = [
    '_nodeName' => 'root',
    '_val' => [
        [
            '_nodeName' => 'items',
            '_val' => [
                [
                    '_nodeName' => 'item',
                    '_val' => 'Computer'
                ],
                [
                  '_nodeName' => 'item',
                  '_val' => 'Keyboard'
                ],
                [
                    '_nodeName' => 'item',
                    '_val' => 'Mouse'
                ],
                [
                    '_nodeName' => 'item',
                    '_val' => 'Monitor'
                ],
            ]
        ]
    ]
];

$x = new Arr2Xml('1.0', 'UTF-8');
$xml = $x->convert($payload);