3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = ' <table id="myTable"> <tbody> <tr> <td>08/20/18</td> <td> <a href="https://example.com/1a">Text 1 A</a> </td> <td> <a href="https://example.com/1b">Test 1 B</a> </td> </tr> <tr> <td>08/21/18</td> <td> <a href="https://example.com/2a">Text 2 A</a> </td> <td> <a href="https://example.com/2b">Test 2 B</a> </td> </tr> </tbody> </table> '; // setup DOMDocument $doc = new DOMDocument(); $doc->loadHTML('<?xml encoding="utf-8" ?>' . $html); $xpath = new DOMXPath($doc); // target table using xpath $results = $xpath->query("//*[@id='myTable']"); if ($results->length > 0) { // Results object print_r($results->item(0)); // Results nodeValue print_r($results->item(0)->nodeValue); }
Output for git.master, git.master_jit, rfc.property-hooks
DOMElement Object ( [schemaTypeInfo] => [tagName] => table [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => [nextElementSibling] => [nodeName] => table [nodeValue] => 08/20/18 Text 1 A Test 1 B 08/21/18 Text 2 A Test 2 B [nodeType] => 1 [parentNode] => (object value omitted) [childNodes] => (object value omitted) [firstChild] => (object value omitted) [lastChild] => (object value omitted) [previousSibling] => [nextSibling] => [attributes] => (object value omitted) [ownerDocument] => (object value omitted) [namespaceURI] => [prefix] => [localName] => table [baseURI] => [textContent] => 08/20/18 Text 1 A Test 1 B 08/21/18 Text 2 A Test 2 B ) 08/20/18 Text 1 A Test 1 B 08/21/18 Text 2 A Test 2 B

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:
176.06 ms | 409 KiB | 5 Q