3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $html = '<td class="t_ip">104.131.248.140</td><td class="t_port"> <script type="text/javascript"> //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> </script>50088 </td><td class="t_type"> 5 </td><td class="t_ip">79.101.32.14</td><td class="t_port"> <script type="text/javascript"> //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> </script>45080 </td>'; $dom = new DOMDocument; $dom->loadHTML($html); $root = $dom->documentElement; $tds = $root->getElementsByTagName("td"); print_r($tds); foreach($tds as $key => $value){ print_r($value); echo $value->parentNode->textContent."\n"; }
based on ArFQK
Output for 7.0.20, 7.1.5 - 7.2.0
DOMNodeList Object ( [length] => 5 ) DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 104.131.248.140 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 104.131.248.140 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 5 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 5 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 79.101.32.14 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 79.101.32.14 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080
Output for 5.3.19 - 7.0.6, 7.1.0
DOMNodeList Object ( [length] => 5 ) DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 104.131.248.140 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 104.131.248.140 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 5 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 5 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => 79.101.32.14 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [nextSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => 79.101.32.14 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 DOMElement Object ( [tagName] => td [schemaTypeInfo] => [nodeName] => td [nodeValue] => //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => (object value omitted) [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => td [baseURI] => [textContent] => //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080 ) 104.131.248.140 //<![CDATA[ document.write(BigBlind^BigBlind^60088); //]]> 50088 5 79.101.32.14 //<![CDATA[ document.write(Polymorth^Polymorth^1080); //]]> 45080