1. Go to this page and download the library: Download fernandoebert/xml-tools 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/ */
fernandoebert / xml-tools example snippets
ernandoebert\XmlTools\xmlTools;
$example = [
"root" => [
"key01" => [
'_value' => "Value Of _value"
],
"key02" => [
'_cdata' => "Value of CDATA",
],
"key03" => [
'@attr' => [
'key01' => 'ValuesOfAttr01',
'key02' => 'valuesOfAttr02',
'key03' => 'valuesOfAttr03',
],
'subkey01' => [
'item01',
'item02',
'item03',
'item04',
]
]
]
];
// to not use the Content-type header, use the second parameter ($header) as false
// $xml = xmlTools::xml_encode($example, false);
$xml = xmlTools::xml_encode($example);
echo $xml;