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 = 17, Position 2 = 29
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/BGsup
function name:  (null)
number of ops:  31
compiled vars:  !0 = $XML, !1 = $dom, !2 = $items, !3 = $it, !4 = $item, !5 = $k
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
   19    11        ECHO                                                     '----%0A'
   20    12        NEW                                              $13     'IteratorIterator'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $13
   21    16      > FE_RESET_R                                       $16     !3, ->29
         17    > > FE_FETCH_R                                       ~17     $16, !4, ->29
         18    >   ASSIGN                                                   !5, ~17
   22    19        CONCAT                                           ~19     'K%3A+', !5
         20        CONCAT                                           ~20     ~19, '++Item%3A+'
         21        FETCH_OBJ_R                                      ~21     !4, 'nodeName'
         22        CONCAT                                           ~22     ~20, ~21
         23        CONCAT                                           ~23     ~22, '+Value%3A+'
         24        FETCH_OBJ_R                                      ~24     !4, 'nodeValue'
         25        CONCAT                                           ~25     ~23, ~24
         26        CONCAT                                           ~26     ~25, '%0A'
         27        ECHO                                                     ~26
   21    28      > JMP                                                      ->17
         29    >   FE_FREE                                                  $16
   23    30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.43 ms | 1386 KiB | 13 Q