Login   Register  
PHP Classes
elePHPant
Icontem

File: example-01.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Mustafa TURAN  >  Array 2 XML OO  >  example-01.php  >  Download  
File: example-01.php
Role: Example script
Content type: text/plain
Description: example usage 01
Class: Array 2 XML OO
Generate a XML document from array values
Author: By
Last change: Added a comment
Date: 4 years ago
Size: 562 bytes
 

Contents

Class file image Download
<?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;
?>