3v4l.org

run code in 300+ PHP versions simultaneously
<?php $doc = new DOMDocument(); $doc->loadXML('<products><item>A</item><item>B</item></products>'); $list = $doc->getElementsByTagName('item'); foreach($list as $item) { var_dump(get_class($item)); var_dump(method_exists($item, '__toString')); var_dump((string)$item); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 28
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 28
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/uZIqJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $doc, !1 = $list, !2 = $item
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        INIT_METHOD_CALL                                         !0, 'loadXML'
          4        SEND_VAL_EX                                              '%3Cproducts%3E%3Citem%3EA%3C%2Fitem%3E%3Citem%3EB%3C%2Fitem%3E%3C%2Fproducts%3E'
          5        DO_FCALL                                      0          
    6     6        INIT_METHOD_CALL                                         !0, 'getElementsByTagName'
          7        SEND_VAL_EX                                              'item'
          8        DO_FCALL                                      0  $7      
          9        ASSIGN                                                   !1, $7
    8    10      > FE_RESET_R                                       $9      !1, ->28
         11    > > FE_FETCH_R                                               $9, !2, ->28
    9    12    >   INIT_FCALL                                               'var_dump'
         13        GET_CLASS                                        ~10     !2
         14        SEND_VAL                                                 ~10
         15        DO_ICALL                                                 
   10    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'method_exists'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 '__toString'
         20        DO_ICALL                                         $12     
         21        SEND_VAR                                                 $12
         22        DO_ICALL                                                 
   11    23        INIT_FCALL                                               'var_dump'
         24        CAST                                          6  ~14     !2
         25        SEND_VAL                                                 ~14
         26        DO_ICALL                                                 
    8    27      > JMP                                                      ->11
         28    >   FE_FREE                                                  $9
   12    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.87 ms | 1396 KiB | 17 Q