PHP code example of alvaro / xmltoarray

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

    

alvaro / xmltoarray example snippets


$xmlPath = 'filepath';
$xmlToArray = new \Alvaro\Xmltoarray\XmlParser($xmlPath);
$arrayResult = $xmlToArray->parse();

$xmlToArray = new \Alvaro\Xmltoarray\XmlParser($xmlPath);
$xmlToArray->

$xmlToArray = new \Alvaro\Xmltoarray\XmlParser($xmlPath);
$rootElement = $xmlToArray->getRootElementText(false);