3v4l.org

run code in 300+ PHP versions simultaneously
<?php $XML = <<< XML <root> <item>1</item> <item>2</item> <item>3</item> </root> XML; $dom = new DomDocument(); $dom->loadXml($XML); $items = $dom->getElementsByTagName('item'); foreach ($items as $k => $item) { print "K: ".$k." Item: ".$item->nodeName. " Value: ".$item->nodeValue. PHP_EOL; } print "----" . PHP_EOL; $it = new IteratorIterator($items); foreach ($it as $k => $item) { print "K: ".$k." Item: ".$item->nodeName. " Value: ".$item->nodeValue. PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 24
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 24
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 24
2 jumps found. (Code = 77) Position 1 = 31, Position 2 = 43
Branch analysis from position: 31
2 jumps found. (Code = 78) Position 1 = 32, Position 2 = 43
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 24
filename:       /in/IGWHd
function name:  (null)
number of ops:  45
compiled vars:  !0 = $XML, !1 = $dom, !2 = $items, !3 = $item, !4 = $k, !5 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Croot%3E%0A++%3Citem%3E1%3C%2Fitem%3E%0A++%3Citem%3E2%3C%2Fitem%3E%0A++%3Citem%3E3%3C%2Fitem%3E%0A%3C%2Froot%3E'
   11     1        NEW                                              $7      'DomDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   12     4        INIT_METHOD_CALL                                         !1, 'loadXml'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   13     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'item'
          9        DO_FCALL                                      0  $11     
         10        ASSIGN                                                   !2, $11
   15    11      > FE_RESET_R                                       $13     !2, ->24
         12    > > FE_FETCH_R                                       ~14     $13, !3, ->24
         13    >   ASSIGN                                                   !4, ~14
   16    14        CONCAT                                           ~16     'K%3A+', !4
         15        CONCAT                                           ~17     ~16, '++Item%3A+'
         16        FETCH_OBJ_R                                      ~18     !3, 'nodeName'
         17        CONCAT                                           ~19     ~17, ~18
         18        CONCAT                                           ~20     ~19, '+Value%3A+'
         19        FETCH_OBJ_R                                      ~21     !3, 'nodeValue'
         20        CONCAT                                           ~22     ~20, ~21
         21        CONCAT                                           ~23     ~22, '%0A'
         22        ECHO                                                     ~23
   15    23      > JMP                                                      ->12
         24    >   FE_FREE                                                  $13
   19    25        ECHO                                                     '----%0A'
   20    26        NEW                                              $24     'IteratorIterator'
         27        SEND_VAR_EX                                              !2
         28        DO_FCALL                                      0          
         29        ASSIGN                                                   !5, $24
   21    30      > FE_RESET_R                                       $27     !5, ->43
         31    > > FE_FETCH_R                                       ~28     $27, !3, ->43
         32    >   ASSIGN                                                   !4, ~28
   22    33        CONCAT                                           ~30     'K%3A+', !4
         34        CONCAT                                           ~31     ~30, '++Item%3A+'
         35        FETCH_OBJ_R                                      ~32     !3, 'nodeName'
         36        CONCAT                                           ~33     ~31, ~32
         37        CONCAT                                           ~34     ~33, '+Value%3A+'
         38        FETCH_OBJ_R                                      ~35     !3, 'nodeValue'
         39        CONCAT                                           ~36     ~34, ~35
         40        CONCAT                                           ~37     ~36, '%0A'
         41        ECHO                                                     ~37
   21    42      > JMP                                                      ->31
         43    >   FE_FREE                                                  $27
   23    44      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.07 ms | 1399 KiB | 13 Q