What are the differences between using XML in PHP4 and PHP5?

In PHP4, the XML functions were limited and not as robust as in PHP5. PHP5 introduced the SimpleXML extension, which provides a more user-friendly way to handle XML data. To take advantage of the improved XML functionality in PHP5, developers should use SimpleXML for parsing and manipulating XML data.

// PHP5 code using SimpleXML to parse XML data
$xml = simplexml_load_string($xmlString);
foreach($xml->children() as $child) {
    echo $child->getName() . ": " . $child . "<br>";
}