3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <h2>My title 1</h2> <h3>Sub-heading</h3> <p>...<span><a href='#'>...</a></span></p> <div>...</div> <h2>My title 2</h2> <p>No sub-heading here :O</p> <h3>But here</h3> <p>No link</p> <h2>And so on...</h2> <p>...</p> <div><h2>This is nested</h2></div> HTML; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXpath($doc); $domNodeList = $xpath->query('/html/body/h2'); $sets = array(); foreach($domNodeList as $element) { // Save the h2 $set = array($element); // Loop the siblings unit the next h2 while ($element = $element->nextSibling) { if ($element->nodeName === "h2") { break; } // if Node is a DOMElement if ($element->nodeType === 1) { $set[] = $element; } } $sets[] = $set; } var_dump($sets);
Output for 8.3.0 - 8.3.6
array(3) { [0]=> array(4) { [0]=> object(DOMElement)#3 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 1" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 1" } [1]=> object(DOMElement)#9 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h3" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(11) "Sub-heading" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(11) "Sub-heading" } [2]=> object(DOMElement)#10 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(6) "......" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(6) "......" } [3]=> object(DOMElement)#11 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(3) "div" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } } [1]=> array(4) { [0]=> object(DOMElement)#4 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 2" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 2" } [1]=> object(DOMElement)#12 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(22) "No sub-heading here :O" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(22) "No sub-heading here :O" } [2]=> object(DOMElement)#13 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h3" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(8) "But here" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(8) "But here" } [3]=> object(DOMElement)#14 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(7) "No link" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(7) "No link" } } [2]=> array(3) { [0]=> object(DOMElement)#5 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(12) "And so on..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(12) "And so on..." } [1]=> object(DOMElement)#15 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } [2]=> object(DOMElement)#16 (27) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(3) "div" ["className"]=> string(0) "" ["id"]=> string(0) "" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(14) "This is nested" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["parentElement"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["isConnected"]=> bool(true) ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(14) "This is nested" } } }
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
array(3) { [0]=> array(4) { [0]=> object(DOMElement)#3 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 1" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 1" } [1]=> object(DOMElement)#9 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h3" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(11) "Sub-heading" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(11) "Sub-heading" } [2]=> object(DOMElement)#10 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(6) "......" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(6) "......" } [3]=> object(DOMElement)#11 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(3) "div" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } } [1]=> array(4) { [0]=> object(DOMElement)#4 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 2" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 2" } [1]=> object(DOMElement)#12 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(22) "No sub-heading here :O" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(22) "No sub-heading here :O" } [2]=> object(DOMElement)#13 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h3" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(8) "But here" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(8) "But here" } [3]=> object(DOMElement)#14 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(7) "No link" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(7) "No link" } } [2]=> array(3) { [0]=> object(DOMElement)#5 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "h2" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(12) "And so on..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(12) "And so on..." } [1]=> object(DOMElement)#15 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(1) "p" ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } [2]=> object(DOMElement)#16 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(3) "div" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(14) "This is nested" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(14) "This is nested" } } }
Output for 8.0.0 - 8.0.30
array(3) { [0]=> array(4) { [0]=> object(DOMElement)#3 (23) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 1" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 1" } [1]=> object(DOMElement)#9 (23) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(11) "Sub-heading" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(11) "Sub-heading" } [2]=> object(DOMElement)#10 (23) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(6) "......" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(6) "......" } [3]=> object(DOMElement)#11 (23) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } } [1]=> array(4) { [0]=> object(DOMElement)#4 (23) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 2" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 2" } [1]=> object(DOMElement)#12 (23) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(22) "No sub-heading here :O" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(22) "No sub-heading here :O" } [2]=> object(DOMElement)#13 (23) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(8) "But here" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(8) "But here" } [3]=> object(DOMElement)#14 (23) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(7) "No link" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(7) "No link" } } [2]=> array(3) { [0]=> object(DOMElement)#5 (23) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(12) "And so on..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(12) "And so on..." } [1]=> object(DOMElement)#15 (23) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> NULL ["lastElementChild"]=> NULL ["childElementCount"]=> int(0) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } [2]=> object(DOMElement)#16 (23) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(1) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(14) "This is nested" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(14) "This is nested" } } }
Output for 7.0.16 - 7.0.33, 7.1.2 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
array(3) { [0]=> array(4) { [0]=> object(DOMElement)#3 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 1" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 1" } [1]=> object(DOMElement)#9 (18) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(11) "Sub-heading" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(11) "Sub-heading" } [2]=> object(DOMElement)#10 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(6) "......" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(6) "......" } [3]=> object(DOMElement)#11 (18) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } } [1]=> array(4) { [0]=> object(DOMElement)#4 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 2" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 2" } [1]=> object(DOMElement)#12 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(22) "No sub-heading here :O" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(22) "No sub-heading here :O" } [2]=> object(DOMElement)#13 (18) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(8) "But here" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(8) "But here" } [3]=> object(DOMElement)#14 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(7) "No link" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(7) "No link" } } [2]=> array(3) { [0]=> object(DOMElement)#5 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(12) "And so on..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(12) "And so on..." } [1]=> object(DOMElement)#15 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } [2]=> object(DOMElement)#16 (18) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(14) "This is nested" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> NULL ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(14) "This is nested" } } }
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.15, 7.1.0 - 7.1.1
array(3) { [0]=> array(4) { [0]=> object(DOMElement)#3 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 1" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> NULL ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 1" } [1]=> object(DOMElement)#9 (18) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(11) "Sub-heading" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(11) "Sub-heading" } [2]=> object(DOMElement)#10 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(6) "......" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(6) "......" } [3]=> object(DOMElement)#11 (18) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } } [1]=> array(4) { [0]=> object(DOMElement)#4 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(10) "My title 2" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(10) "My title 2" } [1]=> object(DOMElement)#12 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(22) "No sub-heading here :O" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(22) "No sub-heading here :O" } [2]=> object(DOMElement)#13 (18) { ["tagName"]=> string(2) "h3" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h3" ["nodeValue"]=> string(8) "But here" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h3" ["baseURI"]=> NULL ["textContent"]=> string(8) "But here" } [3]=> object(DOMElement)#14 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(7) "No link" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(7) "No link" } } [2]=> array(3) { [0]=> object(DOMElement)#5 (18) { ["tagName"]=> string(2) "h2" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(2) "h2" ["nodeValue"]=> string(12) "And so on..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(2) "h2" ["baseURI"]=> NULL ["textContent"]=> string(12) "And so on..." } [1]=> object(DOMElement)#15 (18) { ["tagName"]=> string(1) "p" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(1) "p" ["nodeValue"]=> string(3) "..." ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["nextSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(1) "p" ["baseURI"]=> NULL ["textContent"]=> string(3) "..." } [2]=> object(DOMElement)#16 (17) { ["tagName"]=> string(3) "div" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(3) "div" ["nodeValue"]=> string(14) "This is nested" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> string(22) "(object value omitted)" ["lastChild"]=> string(22) "(object value omitted)" ["previousSibling"]=> string(22) "(object value omitted)" ["attributes"]=> string(22) "(object value omitted)" ["ownerDocument"]=> string(22) "(object value omitted)" ["namespaceURI"]=> NULL ["prefix"]=> string(0) "" ["localName"]=> string(3) "div" ["baseURI"]=> NULL ["textContent"]=> string(14) "This is nested" } } }

preferences:
350.72 ms | 426 KiB | 339 Q