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($dom->getElementsByTagName('item')); 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 = 34, Position 2 = 46
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 46
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 24
filename:       /in/sLdVL
function name:  (null)
number of ops:  48
compiled vars:  !0 = $XML, !1 = $dom, !2 = $items, !3 = $item, !4 = $k, !5 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     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'
   10     1        NEW                                              $7      'DomDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   11     4        INIT_METHOD_CALL                                         !1, 'loadXml'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   12     7        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
          8        SEND_VAL_EX                                              'item'
          9        DO_FCALL                                      0  $11     
         10        ASSIGN                                                   !2, $11
   14    11      > FE_RESET_R                                       $13     !2, ->24
         12    > > FE_FETCH_R                                       ~14     $13, !3, ->24
         13    >   ASSIGN                                                   !4, ~14
   15    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
   14    23      > JMP                                                      ->12
         24    >   FE_FREE                                                  $13
   18    25        ECHO                                                     '----%0A'
   19    26        NEW                                              $24     'IteratorIterator'
         27        INIT_METHOD_CALL                                         !1, 'getElementsByTagName'
         28        SEND_VAL_EX                                              'item'
         29        DO_FCALL                                      0  $25     
         30        SEND_VAR_NO_REF_EX                                       $25
         31        DO_FCALL                                      0          
         32        ASSIGN                                                   !5, $24
   20    33      > FE_RESET_R                                       $28     !5, ->46
         34    > > FE_FETCH_R                                       ~29     $28, !3, ->46
         35    >   ASSIGN                                                   !4, ~29
   21    36        CONCAT                                           ~31     'K%3A+', !4
         37        CONCAT                                           ~32     ~31, '++Item%3A+'
         38        FETCH_OBJ_R                                      ~33     !3, 'nodeName'
         39        CONCAT                                           ~34     ~32, ~33
         40        CONCAT                                           ~35     ~34, '+Value%3A+'
         41        FETCH_OBJ_R                                      ~36     !3, 'nodeValue'
         42        CONCAT                                           ~37     ~35, ~36
         43        CONCAT                                           ~38     ~37, '%0A'
         44        ECHO                                                     ~38
   20    45      > JMP                                                      ->34
         46    >   FE_FREE                                                  $28
   22    47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.31 ms | 1403 KiB | 13 Q