Statement on glibc/iconv Vulnerability

DOMNode::contains

(PHP 8 >= 8.3.0)

DOMNode::containsChecks if node contains other node

Descrizione

public DOMNode::contains(DOMNode|DOMNameSpaceNode|null $other): bool

Checks if node contains other node.

Elenco dei parametri

other

Node to be checked.

Valori restituiti

Returns true if node contains other node, false otherwise.

Esempi

Example #1 DOMNode::contains() example

<?php

$dom
= new DOMDocument();
$dom->loadXML(<<<XML
<!DOCTYPE HTML>
<html>
<body>
<main>
<p>Hello, world!</p>
</main>
</body>
</html>
XML);

$xpath = new DOMXPath($dom);
$main = $xpath->query("//main")[0];

var_dump($dom->documentElement->contains($main));
?>

Il precedente esempio visualizzerà:

bool(true)
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top