How can XML data be efficiently stored in a file like "content.xml" using PHP?

To efficiently store XML data in a file like "content.xml" using PHP, you can use the SimpleXMLElement class to create and manipulate XML data. You can then use the saveXML() method to save the XML data to a file.

<?php
// Create a new SimpleXMLElement object
$xml = new SimpleXMLElement('<data></data>');

// Add data to the XML object
$xml->addChild('name', 'John Doe');
$xml->addChild('age', 30);

// Save the XML data to a file
$xml->asXML('content.xml');
?>