PHP code example of kristofferhagen / simplexml2flatarray

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

    

kristofferhagen / simplexml2flatarray example snippets


// Load from file
$simplexml = simplexml_load_file('data.xml');

// Load from string
$simplexml = simplexml_load_string($xml_string);

$xml = new SimpleXML2FlatArray($simplexml);

$data = $xml->get();

foreach ($xml as $v) {
    // $v is a key => value pair of values parsed from the xml
    var_dump($v);
}