Help with php arrays in function

Hello below is the code iam using. It works fine and outputs the content of an xml tag. but i want to store this in an array. Please help me do this.

<?php
$new =array();
$file ="<?xml version=‘1.0’ encoding=‘utf-8’?>
<Sites>
<Site>
<URL>www.SitePoint.com</URL>
<Title>SitePoint Hub</Title>
</Site>
<Site>
<URL>www.WebmasterBase.com</URL>
<Title>Build your Site</Title>
</Site>
</Sites>";
function contents($parser, $data){
echo “<p>”.$data."</p>";
$new.=$data;

}
function startTag($parser, $data){

echo “<b>”.$data."<br>";

echo “<b>”;
}
function endTag($parser, $data){

echo “</b><br />”.$data."<br>";

echo "&lt;b&gt;";

}
$xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, “startTag”, “endTag”);
xml_set_character_data_handler($xml_parser, “contents”);

$data = $file;
if(!(xml_parse($xml_parser, $data))){
die("Error on line " . xml_get_current_line_number($xml_parser));
}
xml_parser_free($xml_parser);
?>

here is the oputput i receive

**

**www.SitePoint.com
**

**SitePoint Hub
**

**

**

**www.WebmasterBase.com
**

**Build your Site
**

**

**Array **************************

Any help

Thanks,
Sandeep. B

if i declare the variable inside the function it accepts it as a single string. But not as an array. I tried explode but had no success. So any help