Location: PHPKode > scripts > Array 2 XML OO > example-01.php
<?php
/* // sample array */
$arr = Array();
$arr['files'][0]['f_title'] = 'File 1';
$arr['files'][0]['f_size'] = '120KB';
$arr['files'][1]['f_title'] = 'File 2';
$arr['files'][1]['f_size'] = '420KB';
$arr['files'][2]['f_title'] = 'File 3';
$arr['files'][2]['f_size'] = '13KB';

/* // load dependencies */
require_once "array2xml-oo.php";

$xml_data = new array2xml();
$xml_data->setArr($arr);
$xml_file = $xml_data->createXML();
$xml_data = null;

/* // print to screen */
header ("Content-Type: text/xml; charset=utf-8");
echo $xml_file;
?>
Return current item: Array 2 XML OO