:: Forum >> General/Off-topic >>

XML build through PHP

hi,


i need to do this : $docXml="<" . $name.">"."</" . $name.">";
but when I do this: print ($docXml), it print nothing.
I think that: ">" is the problem, why????

Sorry, my english is very bad.....


Thanks.
jordi
Thursday, February 23, 2006
$items = array('name'=>'Tony','age'=>'27');
$docXML '<?xml version="1.0" encoding="iso-8859-1"?><root>';
foreach (
$items as $k => $v) {
     
$docXML .= '<'.$k.'>'.$v.'</'.$k.'>';
}
$docXML .= '</root>';

// This is an important line, you need to send a header
header('Content-Type: text/xml');
echo 
$docXML;
 
Tony
Thursday, February 23, 2006



This topic is archived.

Back to support forum

Forum search