Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of emnu  >  Array2XML  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example on howto use the class
Class: Array2XML
Generate an XML document from array data
Author: By
Last change:
Date: 2008-08-12 19:41
Size: 1,242 bytes
 

Contents

Class file image Download
<?php

// array sample
$sample = Array
(
    
=> Array
        (
            
'Post' => Array
                (
                    
'id' => 1,
                    
'title' => 'The title',
                    
'body' => 'This is the post body.',
                    
'created' => '2008-07-28 12:01:06',
                    
'modified' => '',
                )
        ),
    
=> Array
        (
            
'Post' => Array
                (
                    
'id' => 2,
                    
'title' => 'A title once again',
                    
'body' => 'And the post body follows.',
                    
'created' => '2008-07-28 12:01:06',
                    
'modified' => '',
                    array(
'fdgs'),
                )
        ),
    
=> Array
        (
            
'Post' => Array
                (
                    
'id' => 3,
                    
'title' => 'Title strikes back',
                    
'body' => 'This is really exciting Not.',
                    
'created' => '2008-07-28 12:01:06',
                    
'modified' => '',
                )
        ),
);

// howto
include ('array2xml.php');

$xml = new arr2xml($sample);
header ("content-type: text/xml");
echo 
$xml->get_xml();

?>