PHP code example of baraja-core / xml-to-php-array
1. Go to this page and download the library: Download baraja-core/xml-to-php-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/ */
baraja-core / xml-to-php-array example snippets
$resultArray = Convertor::covertToArray($xml);
$a = json_decode(json_encode((array) Convertor::covertToArray($s)), true);
xml
<tv>
<show name="Family Guy">
<dog>Brian</dog>
<kid>Chris</kid>
<kid>Meg</kid>
</show>
</tv>
xml
<tv>
<show name="Family Guy">
<dog>Brian</dog>
<kid>Chris</kid>
<kid>Meg</kid>
<kid><![CDATA[<em>Stewie</em>]]></kid>
</show>
</tv>