3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOF <table> <tr> <td>something</td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> <tr> <td>anything</td> <td>...</td> <td>...</td> </tr> <tr> <td></td> <td>...</td> <td>...</td> </tr> </table> EOF; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DomXpath($doc); $res = $xpath->query('//tr'); foreach($res 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(3) ["previousElementSibling"]=> NULL ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(28) "something ... ... " ["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(28) "something ... ... " } object(DOMElement)#4 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(3) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(19) " ... ... " ["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(19) " ... ... " } object(DOMElement)#5 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(3) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(19) " ... ... " ["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(19) " ... ... " } object(DOMElement)#6 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(3) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> string(22) "(object value omitted)" ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(27) "anything ... ... " ["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(27) "anything ... ... " } object(DOMElement)#7 (23) { ["schemaTypeInfo"]=> NULL ["tagName"]=> string(2) "tr" ["firstElementChild"]=> string(22) "(object value omitted)" ["lastElementChild"]=> string(22) "(object value omitted)" ["childElementCount"]=> int(3) ["previousElementSibling"]=> string(22) "(object value omitted)" ["nextElementSibling"]=> NULL ["nodeName"]=> string(2) "tr" ["nodeValue"]=> string(19) " ... ... " ["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(19) " ... ... " }

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:
39.35 ms | 413 KiB | 8 Q