PHP code example of bulton-fr / php-to-xml
1. Go to this page and download the library: Download bulton-fr/php-to-xml 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/ */
bulton-fr / php-to-xml example snippets
$phpStructure = (object) [
'elements' => (object) [
'elemA' => [
0 => (object) [
'elemB' => 'Toto',
'elemC' => 'Foo',
'elemD' => (object) [
'elemE' => [
'Foo',
'Bar'
]
]
],
1 => (object) [
'elemB' => 'Titi',
'elemC' => 'Fii',
'elemD' => (object) [
'elemE' => [
'Fii',
'Ber'
]
]
]
]
]
];
echo json_encode($phpStructure);
$phpToXml = new \bultonFr\PhpToXml\PhpToXml;
echo $phpToXml->convert($phpStructure);