3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $doc->preserveWhiteSpace = false; $doc->loadXML( <<<EOXML <x> <item1 /> <item2 /> <item3 /> <item4 /> <item5 /> </x> EOXML ); foreach ($doc->documentElement->childNodes as $i => $node) { echo $node->localName . PHP_EOL; if ($i === 2) { $node->remove(); } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/TJLvF
function name:  (null)
number of ops:  23
compiled vars:  !0 = $doc, !1 = $node, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $3      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    4     3        ASSIGN_OBJ                                               !0, 'preserveWhiteSpace'
          4        OP_DATA                                                  <false>
    5     5        INIT_METHOD_CALL                                         !0, 'loadXML'
    7     6        SEND_VAL_EX                                              '++++%3Cx%3E%0A++++++++%3Citem1+%2F%3E%0A++++++++%3Citem2+%2F%3E%0A++++++++%3Citem3+%2F%3E%0A++++++++%3Citem4+%2F%3E%0A++++++++%3Citem5+%2F%3E%0A++++%3C%2Fx%3E'
    5     7        DO_FCALL                                      0          
   17     8        FETCH_OBJ_R                                      ~8      !0, 'documentElement'
          9        FETCH_OBJ_R                                      ~9      ~8, 'childNodes'
         10      > FE_RESET_R                                       $10     ~9, ->21
         11    > > FE_FETCH_R                                       ~11     $10, !1, ->21
         12    >   ASSIGN                                                   !2, ~11
   18    13        FETCH_OBJ_R                                      ~13     !1, 'localName'
         14        CONCAT                                           ~14     ~13, '%0A'
         15        ECHO                                                     ~14
   19    16        IS_IDENTICAL                                             !2, 2
         17      > JMPZ                                                     ~15, ->20
   20    18    >   INIT_METHOD_CALL                                         !1, 'remove'
         19        DO_FCALL                                      0          
   17    20    > > JMP                                                      ->11
         21    >   FE_FREE                                                  $10
   22    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.65 ms | 999 KiB | 13 Q