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(); foreach($xpath->query('//table[@class="grilla"]/tbody/tr/td/text()') as $key => $td) { array_push($tds, $td->nodeValue); } print_r(array_unique($tds)); $ee = array_chunk($tds, 2); print_r(array_unique($ee));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/oAgsU
function name:  (null)
number of ops:  45
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_METHOD_CALL                                         !2, 'query'
         15        SEND_VAL_EX                                              '%2F%2Ftable%5B%40class%3D%22grilla%22%5D%2Ftbody%2Ftr%2Ftd%2Ftext%28%29'
         16        DO_FCALL                                      0  $18     
         17      > FE_RESET_R                                       $19     $18, ->26
         18    > > FE_FETCH_R                                       ~20     $19, !4, ->26
         19    >   ASSIGN                                                   !5, ~20
   52    20        INIT_FCALL                                               'array_push'
         21        SEND_REF                                                 !3
         22        FETCH_OBJ_R                                      ~22     !4, 'nodeValue'
         23        SEND_VAL                                                 ~22
         24        DO_ICALL                                                 
   50    25      > JMP                                                      ->18
         26    >   FE_FREE                                                  $19
   54    27        INIT_FCALL                                               'print_r'
         28        INIT_FCALL                                               'array_unique'
         29        SEND_VAR                                                 !3
         30        DO_ICALL                                         $24     
         31        SEND_VAR                                                 $24
         32        DO_ICALL                                                 
   55    33        INIT_FCALL                                               'array_chunk'
         34        SEND_VAR                                                 !3
         35        SEND_VAL                                                 2
         36        DO_ICALL                                         $26     
         37        ASSIGN                                                   !6, $26
   56    38        INIT_FCALL                                               'print_r'
         39        INIT_FCALL                                               'array_unique'
         40        SEND_VAR                                                 !6
         41        DO_ICALL                                         $28     
         42        SEND_VAR                                                 $28
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.27 ms | 1400 KiB | 21 Q