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); $table0 = array(); $table1 = array(); foreach($xpath->query('//table[@class="grilla"]') as $key => $table){ $table = "table$key"; foreach($xpath->query("tbody/tr/td/text()", $table) as $node){ array_push($$table, $node->nodeValue); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 39
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 39
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 37
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 37
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
filename:       /in/UTUpc
function name:  (null)
number of ops:  41
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $table0, !4 = $table1, !5 = $table, !6 = $key, !7 = $node
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                                              $11     'DOMDocument'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $11
   47     6        INIT_METHOD_CALL                                         !1, 'loadHTML'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
   48     9        NEW                                              $15     'DOMXPath'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $15
   50    13        ASSIGN                                                   !3, <array>
   51    14        ASSIGN                                                   !4, <array>
   52    15        INIT_METHOD_CALL                                         !2, 'query'
         16        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D'
         17        DO_FCALL                                      0  $20     
         18      > FE_RESET_R                                       $21     $20, ->39
         19    > > FE_FETCH_R                                       ~22     $21, !5, ->39
         20    >   ASSIGN                                                   !6, ~22
   53    21        NOP                                                      
         22        FAST_CONCAT                                      ~24     'table', !6
         23        ASSIGN                                                   !5, ~24
   54    24        INIT_METHOD_CALL                                         !2, 'query'
         25        SEND_VAL_EX                                              'tbody%2Ftr%2Ftd%2Ftext%28%29'
         26        SEND_VAR_EX                                              !5
         27        DO_FCALL                                      0  $26     
         28      > FE_RESET_R                                       $27     $26, ->37
         29    > > FE_FETCH_R                                               $27, !7, ->37
   55    30    >   INIT_FCALL                                               'array_push'
         31        FETCH_W                      local               $28     !5
         32        SEND_REF                                                 $28
         33        FETCH_OBJ_R                                      ~29     !7, 'nodeValue'
         34        SEND_VAL                                                 ~29
         35        DO_ICALL                                                 
   54    36      > JMP                                                      ->29
         37    >   FE_FREE                                                  $27
   52    38      > JMP                                                      ->19
         39    >   FE_FREE                                                  $21
   57    40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.67 ms | 1400 KiB | 15 Q