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()')); foreach($xpath->query('//table[@class="grilla"]/tbody/tr/td/text()') as $key => $td) { array_push($tds, $td); } $ee = array_chunk($tds, 2); print_r($ee);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 31
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/H4qRP
function name:  (null)
number of ops:  41
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $tds, !4 = $td, !5 = $key, !6 = $ee
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%3Chead%3E%3C%2Fhead%3E%3Cbody%3E'
    5     1        ASSIGN_OP                                     8          !0, '%3Ctable+class%3D%22grilla%22%3E%3Ctbody%3E%3Ctr+class%3D%22textEncabezadoGrilla%22+bgcolor%3D%22%23C0DAF1%22+align%3D%22center%22%3E%0A%09%09%09%09%09++++++++++%3Cth%3EJuzgado+Polic%C3%ADa+Local%3C%2Fth%3E%0A%09%09%09%09%09++++++++++%3Cth%3ERol+Causa%3C%2Fth%3E%0A%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%0A%09%09%09%09++++++++%09%0A%09%09%09%09++++++++%09%0A%09%09%09%09%09%09++++++++%3Ctr%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid2%22%3E2+JPL+PROVIDENCIA%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid2%22%3E018092+-+2010%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%09%09%09%09%09%09++++++++%0A%09%09%09++++++++++%09%09%0A%09%09%09%09%09%09++++++++%3Ctr%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid1%22%3EOVALLE+JPL%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid1%22%3E13115+-+2010%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%09%09%09%09%09%09++++++++%0A%09%09%09++++++++++%09%09%0A%09%09%09++++++++%3C%2Ftbody%3E%3C%2Ftable%3E%0A%09%09%09++++++++%3Ctable+class%3D%22grilla%22%3E%3Ctbody%3E%3Ctr+class%3D%22textEncabezadoGrilla%22+bgcolor%3D%22%23C0DAF1%22+align%3D%22center%22%3E%0A%09%09%09%09%09++++++++++%3Cth%3EJuzgado+Polic%C3%ADa+Local%3C%2Fth%3E%0A%09%09%09%09%09++++++++++%3Cth%3ERol+Causa%3C%2Fth%3E%0A%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%0A%09%09%09%09++++++++%09%0A%09%09%09%09++++++++%09%0A%09%09%09%09%09%09++++++++%3Ctr%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid2%22%3E2+JPL+PROVIDENCIA%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid2%22%3E018092+-+2010%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%09%09%09%09%09%09++++++++%0A%09%09%09++++++++++%09%09%0A%09%09%09%09%09%09++++++++%3Ctr%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid1%22%3EOVALLE+JPL%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++++%3Ctd+class%3D%22textgrid1%22%3E13116+-+2011%3C%2Ftd%3E%0A%09%09%09%09%09%09++++++++%3C%2Ftr%3E%0A%09%09%09%09%09%09++++++++%0A%09%09%09++++++++++%09%09%0A%09%09%09++++++++%3C%2Ftbody%3E%3C%2Ftable%3E'
   45     2        ASSIGN_OP                                     8          !0, '%3C%2Fbody%3E%3C%2Fhtml%3E'
   46     3        NEW                                              $10     'DOMDocument'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $10
   47     6        INIT_METHOD_CALL                                         !1, 'loadHTML'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   48     9        NEW                                              $14     'DOMXPath'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $14
   49    13        ASSIGN                                                   !3, <array>
   50    14        INIT_FCALL                                               'var_dump'
         15        INIT_METHOD_CALL                                         !2, 'query'
         16        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D%2Ftbody%2Ftr%2Ftd%2Ftext%28%29'
         17        DO_FCALL                                      0  $18     
         18        SEND_VAR                                                 $18
         19        DO_ICALL                                                 
   51    20        INIT_METHOD_CALL                                         !2, 'query'
         21        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D%2Ftbody%2Ftr%2Ftd%2Ftext%28%29'
         22        DO_FCALL                                      0  $20     
         23      > FE_RESET_R                                       $21     $20, ->31
         24    > > FE_FETCH_R                                       ~22     $21, !4, ->31
         25    >   ASSIGN                                                   !5, ~22
   53    26        INIT_FCALL                                               'array_push'
         27        SEND_REF                                                 !3
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                                 
   51    30      > JMP                                                      ->24
         31    >   FE_FREE                                                  $21
   56    32        INIT_FCALL                                               'array_chunk'
         33        SEND_VAR                                                 !3
         34        SEND_VAL                                                 2
         35        DO_ICALL                                         $25     
         36        ASSIGN                                                   !6, $25
   57    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !6
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.91 ms | 1400 KiB | 21 Q