Login   Register  
PHP Classes
elePHPant
Icontem

File: example_array2xml.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ricardo Alexandre Sismeiro  >  XML  >  example_array2xml.php  >  Download  
File: example_array2xml.php
Role: Example script
Content type: text/plain
Description: example
Class: XML
Parse XML documents into arrays and vice-versa
Author: By
Last change:
Date: 6 years ago
Size: 833 bytes
 

Contents

Class file image Download
<?php
      
      
require_once('xml.php');
    
    
$book=array();
      
$book[]=array('author'=>array('Fernado Pessoa'));
      
$book[]=array('title'=>array('Mensagem'));
      
$book[]=array('year'=>array('1934'));      
      
$book['@attributes']=array('isbn'=>'9789722332392');
            
      
$archive=array();
      
$archive[]=array('book'=>$book);
      
$archive[]=array('book'=>$book);
      
$archive['@attributes']=array('lang'=>'pt');
       
      
$archives=array();
      
$archives[]=array('archive'=>$archive);
      
$archives[]=array('archive'=>$archive);
      
$archives[]=array('archive'=>$archive);
      
$archives['@attributes']=array('year'=>'2000','type'=>'literature');
       
      
$library=array();
      
$library[]=array('archives'=>$archives);      
      
      
$xml=new xml();
      
$output=$xml->array2xml($library,'library');
      
      echo 
$output;  
      
?>