3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* Just compose the HTML sample */ $html='<html><head></head><body>'; $html.='<table class="grilla"><tbody><tr class="textEncabezadoGrilla" bgcolor="#C0DAF1" align="center"> <th>Juzgado Policía Local</th> <th>Rol Causa</th> </tr> <tr> <td class="textgrid2">2 JPL PROVIDENCIA</td> <td class="textgrid2">018092 - 2010</td> </tr> <tr> <td class="textgrid1">OVALLE JPL</td> <td class="textgrid1">13115 - 2010</td> </tr> </tbody></table> <table class="grilla"><tbody><tr class="textEncabezadoGrilla" bgcolor="#C0DAF1" align="center"> <th>Juzgado Policía Local</th> <th>Rol Causa</th> </tr> <tr> <td class="textgrid2">2 JPL PROVIDENCIA</td> <td class="textgrid2">018092 - 2010</td> </tr> <tr> <td class="textgrid1">OVALLE JPL</td> <td class="textgrid1">13116 - 2011</td> </tr> </tbody></table>'; $html.="</body></html>"; $doc=new DOMDocument(); $doc->loadHTML($html); $xpath=new DOMXPath($doc); $tds = array(); var_dump($xpath->query('//table[@class="grilla"]/tbody/tr/td/text()')); $table1 = $xpath->query('//table[@class="grilla"]')->item(0); $table2 = $xpath->query('//table[@class="grilla"]')->item(1); foreach($xpath->query('//table[@class="grilla"]') as $key => $td) { array_push($tds, $td); } print_r($tds); $ee = array_chunk($tds, 2);
Output for git.master, git.master_jit, rfc.property-hooks
object(DOMNodeList)#11 (1) { ["length"]=> int(8) } Array ( [0] => DOMElement Object ( [schemaTypeInfo] => [tagName] => table [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => [nextElementSibling] => (object value omitted) [nodeName] => table [nodeValue] => Juzgado Policía Local Rol Causa 2 JPL PROVIDENCIA 018092 - 2010 OVALLE JPL 13115 - 2010 [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] => table [baseURI] => [textContent] => Juzgado Policía Local Rol Causa 2 JPL PROVIDENCIA 018092 - 2010 OVALLE JPL 13115 - 2010 ) [1] => DOMElement Object ( [schemaTypeInfo] => [tagName] => table [firstElementChild] => (object value omitted) [lastElementChild] => (object value omitted) [childElementCount] => 1 [previousElementSibling] => (object value omitted) [nextElementSibling] => [nodeName] => table [nodeValue] => Juzgado Policía Local Rol Causa 2 JPL PROVIDENCIA 018092 - 2010 OVALLE JPL 13116 - 2011 [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] => table [baseURI] => [textContent] => Juzgado Policía Local Rol Causa 2 JPL PROVIDENCIA 018092 - 2010 OVALLE JPL 13116 - 2011 ) )

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:
52.92 ms | 409 KiB | 8 Q