3v4l.org

run code in 300+ PHP versions simultaneously
<?php $clone = my_dom_loader($new_domd->saveHTML()); $clone_xp = new DOMXPath($clone); $should_be_removed = (int)($clone_xp->query("//div[@class='thread']")->item(0)->childNodes->length); $removed = 0; foreach ($clone_xp->query("//div[@class='thread']")->item(0)->childNodes as $child) { ++$removed; $child->parentNode->removeChild($child); } if ($removed !== $should_be_removed) { throw new \LogicException("removed: {$removed} - should be removed: {$should_be_removed}"); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 78) Position 1 = 30, Position 2 = 36
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 47
Branch analysis from position: 39
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/O7IlF
function name:  (null)
number of ops:  48
compiled vars:  !0 = $clone, !1 = $new_domd, !2 = $clone_xp, !3 = $should_be_removed, !4 = $removed, !5 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'my_dom_loader'
          1        INIT_METHOD_CALL                                         !1, 'saveHTML'
          2        DO_FCALL                                      0  $6      
          3        SEND_VAR_NO_REF_EX                                       $6
          4        DO_FCALL                                      0  $7      
          5        ASSIGN                                                   !0, $7
    4     6        NEW                                              $9      'DOMXPath'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $9
    5    10        INIT_METHOD_CALL                                         !2, 'query'
         11        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40class%3D%27thread%27%5D'
         12        DO_FCALL                                      0  $12     
         13        INIT_METHOD_CALL                                         $12, 'item'
         14        SEND_VAL_EX                                              0
         15        DO_FCALL                                      0  $13     
         16        FETCH_OBJ_R                                      ~14     $13, 'childNodes'
         17        FETCH_OBJ_R                                      ~15     ~14, 'length'
         18        CAST                                          4  ~16     ~15
         19        ASSIGN                                                   !3, ~16
    6    20        ASSIGN                                                   !4, 0
    7    21        INIT_METHOD_CALL                                         !2, 'query'
         22        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40class%3D%27thread%27%5D'
         23        DO_FCALL                                      0  $19     
         24        INIT_METHOD_CALL                                         $19, 'item'
         25        SEND_VAL_EX                                              0
         26        DO_FCALL                                      0  $20     
         27        FETCH_OBJ_R                                      ~21     $20, 'childNodes'
         28      > FE_RESET_R                                       $22     ~21, ->36
         29    > > FE_FETCH_R                                               $22, !5, ->36
    8    30    >   PRE_INC                                                  !4
    9    31        FETCH_OBJ_R                                      ~24     !5, 'parentNode'
         32        INIT_METHOD_CALL                                         ~24, 'removeChild'
         33        SEND_VAR_EX                                              !5
         34        DO_FCALL                                      0          
    7    35      > JMP                                                      ->29
         36    >   FE_FREE                                                  $22
   11    37        IS_NOT_IDENTICAL                                         !4, !3
         38      > JMPZ                                                     ~26, ->47
   12    39    >   NEW                                              $27     'LogicException'
         40        ROPE_INIT                                     4  ~29     'removed%3A+'
         41        ROPE_ADD                                      1  ~29     ~29, !4
         42        ROPE_ADD                                      2  ~29     ~29, '+-+should+be+removed%3A+'
         43        ROPE_END                                      3  ~28     ~29, !3
         44        SEND_VAL_EX                                              ~28
         45        DO_FCALL                                      0          
         46      > THROW                                         0          $27
   13    47    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.8 ms | 1403 KiB | 13 Q