PHP code example of macropage / xml-to-php-array

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

    

macropage / xml-to-php-array example snippets


$resultArray = Convertor::covertToArray($xml);

$a = json_decode(json_encode((array) Convertor::covertToArray($s)), true);
shell
composer 
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>