How can PHP be integrated with XML for processing and displaying data?
To integrate PHP with XML for processing and displaying data, you can use PHP's built-in SimpleXML extension. This extension provides an easy way to access and manipulate XML data in PHP. You can load an XML file or string into a SimpleXMLElement object, then use PHP to extract and display the data as needed.
// Load XML data from a file
$xml = simplexml_load_file('data.xml');
// Access and display data from the XML
foreach ($xml->children() as $child) {
echo $child->getName() . ": " . $child . "<br>";
}