DOMNode::getRootNode

(PHP 8 >= 8.3.0)

DOMNode::getRootNodeGet root node

说明

public DOMNode::getRootNode(?array $options = null): DOMNode

Get root node.

参数

options

This parameter has no effect yet.

返回值

Returns the root node.

示例

示例 #1 DOMNode::getRootNode() example

<?php

$dom
= new DOMDocument();
$dom->loadXML('<?xml version="1.0"?><html><body/></html>');

var_dump($dom->documentElement->firstElementChild->getRootNode() === $dom);
?>

以上示例会输出:

bool(true)