DOMNode::getRootNode
PHP function
Edit on GitHub ✎
(PHP 8 >= 8.3.0)
Get root node
Description
DOMNode::getRootNode(array|null $options = null): DOMNode
Get root node.
Parameters
optionsThis parameter has no effect yet.
Return Values
Returns the root node.
Examples
DOMNode::getRootNode example
php
<?php
$dom = new DOMDocument();
$dom->loadXML('<?xml version="1.0"?><html><body/></html>');
var_dump($dom->documentElement->firstElementChild->getRootNode() === $dom);
?>The above example will output:
output
bool(true)