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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 45
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/EbIrb
function name:  (null)
number of ops:  55
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $tds, !4 = $table1, !5 = $table2, !6 = $td, !7 = $key, !8 = $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                                              $12     'DOMDocument'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $12
   47     6        INIT_METHOD_CALL                                         !1, 'loadHTML'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   48     9        NEW                                              $16     'DOMXPath'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $16
   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  $20     
         18        SEND_VAR                                                 $20
         19        DO_ICALL                                                 
   51    20        INIT_METHOD_CALL                                         !2, 'query'
         21        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D'
         22        DO_FCALL                                      0  $22     
         23        INIT_METHOD_CALL                                         $22, 'item'
         24        SEND_VAL_EX                                              0
         25        DO_FCALL                                      0  $23     
         26        ASSIGN                                                   !4, $23
   52    27        INIT_METHOD_CALL                                         !2, 'query'
         28        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D'
         29        DO_FCALL                                      0  $25     
         30        INIT_METHOD_CALL                                         $25, 'item'
         31        SEND_VAL_EX                                              1
         32        DO_FCALL                                      0  $26     
         33        ASSIGN                                                   !5, $26
   53    34        INIT_METHOD_CALL                                         !2, 'query'
         35        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D'
         36        DO_FCALL                                      0  $28     
         37      > FE_RESET_R                                       $29     $28, ->45
         38    > > FE_FETCH_R                                       ~30     $29, !6, ->45
         39    >   ASSIGN                                                   !7, ~30
   55    40        INIT_FCALL                                               'array_push'
         41        SEND_REF                                                 !3
         42        SEND_VAR                                                 !6
         43        DO_ICALL                                                 
   53    44      > JMP                                                      ->38
         45    >   FE_FREE                                                  $29
   57    46        INIT_FCALL                                               'print_r'
         47        SEND_VAR                                                 !3
         48        DO_ICALL                                                 
   58    49        INIT_FCALL                                               'array_chunk'
         50        SEND_VAR                                                 !3
         51        SEND_VAL                                                 2
         52        DO_ICALL                                         $34     
         53        ASSIGN                                                   !8, $34
         54      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.2 ms | 1400 KiB | 21 Q