DOMDocument::append
PHP function
Edit on GitHub ✎
(PHP 8)
Appends nodes after the last child node
Description
DOMDocument::append(DOMNode|string ...$nodes): void
Appends one or many nodes to the list of children after the last child node.
Examples
DOMDocument::append example
Adds nodes after the document root.
php
<?php
$doc = new DOMDocument;
$doc->loadXML("<hello/>");
$doc->append("beautiful", $doc->createElement("world"));
echo $doc->saveXML();
?>The above example will output:
output
<?xml version="1.0"?>
<hello/>
beautiful
<world/>See Also
DOMParentNode::appendDOMDocument::prepend