PHP Portal » PHP Handbuch » DomNode->parent_node

Werbung

DomNode->parent_node


(PHP 4 >= 4.1.0)

DomNode->parent_node Returns the parent of the node

Beschreibung

domnode DomNode->parent_node ( void )

This function returns the parent node.

(PHP >= 4.3 only) If no parent is found, NULL is returned.

The following example will show two identical lists of children.

PHP Code
1
2
3
4
5
6
7
8
$doc = domxml_new_doc("1.0"); $node = $doc->create_element("para"); $node = $doc->append_child($node); $children = $doc->children(); print_r($children); $doc2 = $node->parent_node(); $children = $doc2->children(); print_r($children);