3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<< HTML <html> <body> <table> <tr><td>foo</td><td>bar</td></tr> <tr><td>foo</td><td>bar</td></tr> <tr><td>foo</td><td>bar</td></tr> <tr><td>foo</td><td>bar</td></tr> </table> </body> </html> HTML; $dom = new domdocument; $dom->loadhtml($html); $x = new domxpath($dom); $trs = $x->query('//tr'); foreach ($trs as $tr) { var_dump($tr); }
Output for git.master, git.master_jit, rfc.property-hooks
object(DOMElement)#3 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(2) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(6) "foobar" ["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) "tr" ["baseURI"]=> NULL ["textContent"]=> string(6) "foobar" } object(DOMElement)#4 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(2) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(6) "foobar" ["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) "tr" ["baseURI"]=> NULL ["textContent"]=> string(6) "foobar" } object(DOMElement)#5 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(2) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(6) "foobar" ["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) "tr" ["baseURI"]=> NULL ["textContent"]=> string(6) "foobar" } object(DOMElement)#6 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(2) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(6) "foobar" ["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(2) "tr" ["baseURI"]=> NULL ["textContent"]=> string(6) "foobar" }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.56 ms | 413 KiB | 8 Q