3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str='<div class="table tbl-process-mobile"> <div class="table-cn"> <div class="table-bd"> <table cellspacing="0" id="idd7"> <thead> <tr id="idd9"> <th scope="col"> <span>username</span> </th> <th scope="col"> <span>status</span> </th> <th scope="col"> <span>prefered number</span> </th> <th scope="col"> <span>action</span> </th> </tr> </thead> <tbody id="iddb"> <tr class="even"> <td class="even"> <div>randomusername</div> </td><td class="odd"> <div>0123456789</div> </td><td class="even"> <div>active</div> </td><td class="odd"> <div> <span id="iddc" style="display:none"></span> <a href="xyz" id="idb2"><span>set number</span></a> </div> </td><td class="even"> <div>randomusername</div> </td><td class="odd"> <div>0123456789</div> </td><td class="even"> <div>active</div> </td><td class="odd"> <div> <span id="iddc" style="display:none"></span> <a href="xyz" id="idb2"><span>set number</span></a> </div> </td><td class="even"> <div> <a id="iddd" style="display:none"></a> <a href="xyz" class="action-icon-edit" id="idb3" title="change"> <i>change</i> </a> <a href="xyz" class="action-icon-delete" id="idb4" title="delete"> <i>delete</i> </a> </div> </td> </tr><tr class="odd"> <td class="even"> <div>randomusername2</div> </td><td class="odd"> <div>0987654321</div> </td><td class="even"> <div>active</div> </td><td class="odd"> <div> <span id="idde" style="display:none"></span> <a href="xyz" id="idb5"><span>set number</span></a> </div> </td><td class="even"> <div> <a id="iddf" style="display:none"></a> <a href="xyz" class="action-icon-edit" id="idb6" title="change"> <i>change</i> </a> <a href="xyz" class="action-icon-delete" id="idb7" title="delete"> <i>delete</i> </a> </div> </td> </tr> </tbody> </table> </div> </div> </div>'; $dom = new DOMDocument; $dom->loadHTML($str); $trs = $dom->getElementById("iddb")->getElementsByTagName("tr"); $arr = []; foreach($trs as $key=>$tr){ $tds = $tr->getElementsByTagName("td"); $arr[$key] = [ $tds->item(0)->textContent, $tds->item(1)->textContent, $tds->item(2)->textContent ]; } print_r($arr); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 40
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 40
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/FJIgY
function name:  (null)
number of ops:  45
compiled vars:  !0 = $str, !1 = $dom, !2 = $trs, !3 = $arr, !4 = $tr, !5 = $key, !6 = $tds
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22table+tbl-process-mobile%22%3E%0A++%3Cdiv+class%3D%22table-cn%22%3E%0A++++%3Cdiv+class%3D%22table-bd%22%3E%0A++++++%3Ctable+cellspacing%3D%220%22+id%3D%22idd7%22%3E%0A++++++++%3Cthead%3E%0A++++++++++%3Ctr+id%3D%22idd9%22%3E%0A++++++++++++%3Cth+scope%3D%22col%22%3E%0A++++++++++++++%3Cspan%3Eusername%3C%2Fspan%3E%0A++++++++++++%3C%2Fth%3E%0A++++++++++++%3Cth+scope%3D%22col%22%3E%0A++++++++++++++%3Cspan%3Estatus%3C%2Fspan%3E%0A++++++++++++%3C%2Fth%3E%0A++++++++++++%3Cth+scope%3D%22col%22%3E++++++++%0A++++++++++++++%3Cspan%3Eprefered+number%3C%2Fspan%3E%0A++++++++++++%3C%2Fth%3E%0A++++++++++++%3Cth+scope%3D%22col%22%3E%0A++++++++++++++%3Cspan%3Eaction%3C%2Fspan%3E%0A++++++++++++%3C%2Fth%3E%0A++++++++++%3C%2Ftr%3E%0A++++++++%3C%2Fthead%3E%0A++++++++%3Ctbody+id%3D%22iddb%22%3E%0A++++++++++%3Ctr+class%3D%22even%22%3E%0A++++++++++++%3Ctd+class%3D%22even%22%3E%0A++++++++++++++%3Cdiv%3Erandomusername%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++++%3Cdiv%3E0123456789%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++++%3Cdiv%3Eactive%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++++%3Cdiv%3E%0A++++++++++++++%3Cspan+id%3D%22iddc%22+style%3D%22display%3Anone%22%3E%3C%2Fspan%3E%0A++++++++++++++%3Ca+href%3D%22xyz%22+id%3D%22idb2%22%3E%3Cspan%3Eset+number%3C%2Fspan%3E%3C%2Fa%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++++++%3Cdiv%3Erandomusername%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++++%3Cdiv%3E0123456789%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++++%3Cdiv%3Eactive%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++++%3Cdiv%3E%0A++++++++++++++%3Cspan+id%3D%22iddc%22+style%3D%22display%3Anone%22%3E%3C%2Fspan%3E%0A++++++++++++++%3Ca+href%3D%22xyz%22+id%3D%22idb2%22%3E%3Cspan%3Eset+number%3C%2Fspan%3E%3C%2Fa%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++++%3Cdiv%3E%0A++++++++++++++%3Ca+id%3D%22iddd%22+style%3D%22display%3Anone%22%3E%3C%2Fa%3E%0A++++++++++++++%3Ca+href%3D%22xyz%22+class%3D%22action-icon-edit%22+id%3D%22idb3%22+title%3D%22change%22%3E%0A++++++++++++++++%3Ci%3Echange%3C%2Fi%3E%0A++++++++++++++%3C%2Fa%3E%0A++++++++++++++%3Ca+href%3D%22xyz%22+class%3D%22action-icon-delete%22+id%3D%22idb4%22+title%3D%22delete%22%3E%0A++++++++++++++++%3Ci%3Edelete%3C%2Fi%3E%0A++++++++++++++%3C%2Fa%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++++++%3C%2Ftd%3E%0A++++++++++%3C%2Ftr%3E%3Ctr+class%3D%22odd%22%3E%0A++++++++++%3Ctd+class%3D%22even%22%3E%0A++++++++++++%3Cdiv%3Erandomusername2%3C%2Fdiv%3E%0A++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++%3Cdiv%3E0987654321%3C%2Fdiv%3E%0A++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++%3Cdiv%3Eactive%3C%2Fdiv%3E%0A++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22odd%22%3E%0A++++++++++%3Cdiv%3E%0A++++++++++++%3Cspan+id%3D%22idde%22+style%3D%22display%3Anone%22%3E%3C%2Fspan%3E%0A++++++++++++%3Ca+href%3D%22xyz%22+id%3D%22idb5%22%3E%3Cspan%3Eset+number%3C%2Fspan%3E%3C%2Fa%3E%0A++++++++++%3C%2Fdiv%3E%0A++++++++++%3C%2Ftd%3E%3Ctd+class%3D%22even%22%3E%0A++++++++++%3Cdiv%3E%0A++++++++++++%3Ca+id%3D%22iddf%22+style%3D%22display%3Anone%22%3E%3C%2Fa%3E%0A++++++++++++%3Ca+href%3D%22xyz%22+class%3D%22action-icon-edit%22+id%3D%22idb6%22+title%3D%22change%22%3E%0A++++++++++++++%3Ci%3Echange%3C%2Fi%3E%0A++++++++++++%3C%2Fa%3E%0A++++++++++++%3Ca+href%3D%22xyz%22+class%3D%22action-icon-delete%22+id%3D%22idb7%22+title%3D%22delete%22%3E%0A++++++++++++++%3Ci%3Edelete%3C%2Fi%3E%0A++++++++++++%3C%2Fa%3E%0A++++++++++%3C%2Fdiv%3E%0A++++++++++%3C%2Ftd%3E%0A++++++++++%3C%2Ftr%3E%0A++++++++%3C%2Ftbody%3E%0A++++++%3C%2Ftable%3E%0A++++%3C%2Fdiv%3E%0A++%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   87     1        NEW                                              $8      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $8
   88     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   89     7        INIT_METHOD_CALL                                         !1, 'getElementById'
          8        SEND_VAL_EX                                              'iddb'
          9        DO_FCALL                                      0  $12     
         10        INIT_METHOD_CALL                                         $12, 'getElementsByTagName'
         11        SEND_VAL_EX                                              'tr'
         12        DO_FCALL                                      0  $13     
         13        ASSIGN                                                   !2, $13
   91    14        ASSIGN                                                   !3, <array>
   92    15      > FE_RESET_R                                       $16     !2, ->40
         16    > > FE_FETCH_R                                       ~17     $16, !4, ->40
         17    >   ASSIGN                                                   !5, ~17
   93    18        INIT_METHOD_CALL                                         !4, 'getElementsByTagName'
         19        SEND_VAL_EX                                              'td'
         20        DO_FCALL                                      0  $19     
         21        ASSIGN                                                   !6, $19
   95    22        INIT_METHOD_CALL                                         !6, 'item'
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0  $22     
         25        FETCH_OBJ_R                                      ~23     $22, 'textContent'
         26        INIT_ARRAY                                       ~24     ~23
   96    27        INIT_METHOD_CALL                                         !6, 'item'
         28        SEND_VAL_EX                                              1
         29        DO_FCALL                                      0  $25     
         30        FETCH_OBJ_R                                      ~26     $25, 'textContent'
         31        ADD_ARRAY_ELEMENT                                ~24     ~26
   97    32        INIT_METHOD_CALL                                         !6, 'item'
         33        SEND_VAL_EX                                              2
         34        DO_FCALL                                      0  $27     
         35        FETCH_OBJ_R                                      ~28     $27, 'textContent'
         36        ADD_ARRAY_ELEMENT                                ~24     ~28
   94    37        ASSIGN_DIM                                               !3, !5
   97    38        OP_DATA                                                  ~24
   92    39      > JMP                                                      ->16
         40    >   FE_FREE                                                  $16
  100    41        INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !3
         43        DO_ICALL                                                 
  106    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171 ms | 1404 KiB | 15 Q