Generating XML from an array : htmlentities « HTML « PHP






Generating XML from an array

 
<?
$channel = array('title' => "A",
                 'link' => 'http://example.com/',
                 'description' => 'test');


print "<channel>\n";
foreach ($channel as $element => $content) {
    print " <$element>";
    print htmlentities($content);
    print "</$element>\n";
}
print "</channel>";
?>
  
  








Related examples in the same category

1.Checking for magic quotes
2.htmlentities() function converts all characters into their equivalent HTML entities.
3.htmlentities.php
4.Encoding HTML entities in a string
5.Escaping HTML