3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dom=new DOMDocument; $dom->loadHTML(<<<HTML <div> <a>abc</a> xyz </div> HTML ); $div=$dom->getElementsByTagName("div")->item(0); var_dump($div->childNodes->length);//just to debug $txt=""; foreach(range(0,$div->childNodes->length-1) as $idx) { if($div->childNodes->item($idx)) { $txt.=$div->childNodes->item($idx)->nodeValue; } } var_dump($txt);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 40
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 40
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 39
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 39
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/r2S0P
function name:  (null)
number of ops:  45
compiled vars:  !0 = $dom, !1 = $div, !2 = $txt, !3 = $idx
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $4      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    3     3        INIT_METHOD_CALL                                         !0, 'loadHTML'
    4     4        SEND_VAL_EX                                              '%3Cdiv%3E%0A+++++%3Ca%3Eabc%3C%2Fa%3E%0A+++++xyz%0A%3C%2Fdiv%3E'
          5        DO_FCALL                                      0          
   10     6        INIT_METHOD_CALL                                         !0, 'getElementsByTagName'
          7        SEND_VAL_EX                                              'div'
          8        DO_FCALL                                      0  $8      
          9        INIT_METHOD_CALL                                         $8, 'item'
         10        SEND_VAL_EX                                              0
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !1, $9
   11    13        INIT_FCALL                                               'var_dump'
         14        FETCH_OBJ_R                                      ~11     !1, 'childNodes'
         15        FETCH_OBJ_R                                      ~12     ~11, 'length'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   12    18        ASSIGN                                                   !2, ''
   13    19        INIT_FCALL                                               'range'
         20        SEND_VAL                                                 0
         21        FETCH_OBJ_R                                      ~15     !1, 'childNodes'
         22        FETCH_OBJ_R                                      ~16     ~15, 'length'
         23        SUB                                              ~17     ~16, 1
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                         $18     
         26      > FE_RESET_R                                       $19     $18, ->40
         27    > > FE_FETCH_R                                               $19, !3, ->40
   15    28    >   FETCH_OBJ_R                                      ~20     !1, 'childNodes'
         29        INIT_METHOD_CALL                                         ~20, 'item'
         30        SEND_VAR_EX                                              !3
         31        DO_FCALL                                      0  $21     
         32      > JMPZ                                                     $21, ->39
   17    33    >   FETCH_OBJ_R                                      ~22     !1, 'childNodes'
         34        INIT_METHOD_CALL                                         ~22, 'item'
         35        SEND_VAR_EX                                              !3
         36        DO_FCALL                                      0  $23     
         37        FETCH_OBJ_R                                      ~24     $23, 'nodeValue'
         38        ASSIGN_OP                                     8          !2, ~24
   13    39    > > JMP                                                      ->27
         40    >   FE_FREE                                                  $19
   20    41        INIT_FCALL                                               'var_dump'
         42        SEND_VAR                                                 !2
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.39 ms | 1392 KiB | 17 Q