3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = <<< HTML <a>some stuff we don not want</a> <table cellpadding="2" cellspacing="1" bgcolor="#A0A0A0"> </table> <table id="anothertable"> </table> HTML; $dom = new DOMDocument(); $dom->loadHTML($input); foreach ($dom->getElementsByTagName('table') as $element) { var_dump($element); }
Output for 7.0.0 - 7.1.0
object(DOMElement)#4 (18) { ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" } object(DOMElement)#5 (17) { ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" }
Output for hhvm-3.10.0 - 3.13.2
object(DOMElement)#4 (18) { ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL } object(DOMElement)#5 (18) { ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL }
Output for 5.3.11 - 5.3.29, 5.4.1 - 5.6.28
object(DOMElement)#3 (18) { ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" } object(DOMElement)#5 (17) { ["tagName"]=> string(5) "table" ["schemaTypeInfo"]=> NULL ["nodeName"]=> string(5) "table" ["nodeValue"]=> string(0) "" ["nodeType"]=> int(1) ["parentNode"]=> string(22) "(object value omitted)" ["childNodes"]=> string(22) "(object value omitted)" ["firstChild"]=> NULL ["lastChild"]=> NULL ["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(5) "table" ["baseURI"]=> NULL ["textContent"]=> string(0) "" }
Output for 5.0.0 - 5.3.10, 5.4.0
object(DOMElement)#3 (0) { } object(DOMElement)#5 (0) { }
Output for 4.3.2 - 4.4.1, 4.4.3 - 4.4.9
Fatal error: Cannot instantiate non-existent class: domdocument in /in/281RB on line 10
Process exited with code 255.
Output for 4.4.2
Fatal error: Cannot instantiate non-existent class: domdocument in /in/281RB on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: domdocument in /in/281RB on line 10