<?php

// The array to use
$arr = array(
    
'hello' => 'pie',
    
'xd' => array(
                    
'one' => 'hiyar',
                    
'xdffs' => array('good''day')
                ),
    
'summat' => 'I lolled'
);

// Require class file and instantiate object - array, XML encoding, root element
require 'class.array2xml.php';
$obj = new array2xml($arr'utf-8''array');

// If the query string is 'xml', output the array in such a way
if($_SERVER['QUERY_STRING'] == 'xml')
    
$obj->outputxml();

// Else perform some XPath examples for no real reason
else
{
    echo 
'<h2>'$obj->query('//array/hello')->item(0)->nodeValue'</h2>';
    foreach(
$obj->query('//array/child::*') as $child)
        echo 
$child->tagName'<br />';
}

?>