DOMNode::compareDocumentPosition
2つのノードの位置を比較します。
&reftitle.description;
public intDOMNode::compareDocumentPosition
DOMNodeother
このノードに対するもう一方のノードの位置を比較します。
&reftitle.parameters;
other
このノードに対して、位置を比較すべきノード。
&reftitle.returnvalues;
DOMNode::DOCUMENT_POSITION_* 定数のビットマスク。
&reftitle.examples;
DOMNode::compareDocumentPosition の例
XML;
$dom = new DOMDocument();
$dom->loadXML($xml);
$root = $dom->documentElement;
$child1 = $root->firstElementChild;
$child2 = $child1->nextElementSibling;
var_dump($root->compareDocumentPosition($child1));
var_dump($child2->compareDocumentPosition($child1));
?>
]]>
&example.outputs;