$xml = simplexml_load_file('example.xml');
$xml->addChild('element', 'value');
$xml = new SimpleXMLElement('This code creates a new XML document with a root node and adds a new 'element' node with a value of 'value'. The `asXML()` function is used to convert the document to a string for output. The PHP XML extension is part of the standard PHP library and does not require any additional package installation.'); $xml->addChild('element', 'value'); echo $xml->asXML();