How can XML be parsed and displayed in a desired format using PHP?
To parse and display XML in a desired format using PHP, you can use the SimpleXML extension which provides a simple and easy way to access and manipulate XML data. You can load the XML file using simplexml_load_file() function, then iterate through the XML nodes to extract the desired data and format it as needed.
$xml = simplexml_load_file('data.xml');
foreach ($xml->children() as $child) {
echo $child->getName() . ": " . $child . "<br>";
}