3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { global $d; $d = new DOMDocument; $c = $d->createDocumentFragment(); $g = $d->createElement('fiz', 'buz'); $h = $d->createElement('red', 'xen'); $c->appendChild($g); $c->appendChild($h); return $c->childNodes; } foreach (foo() as $x) { var_dump($x->nodeValue); } var_dump($x->nodeValue); var_dump(get_class($d));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/qa6EP
function name:  (null)
number of ops:  19
compiled vars:  !0 = $x, !1 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $2      
          2      > FE_RESET_R                                       $3      $2, ->9
          3    > > FE_FETCH_R                                               $3, !0, ->9
   17     4    >   INIT_FCALL                                               'var_dump'
          5        FETCH_OBJ_R                                      ~4      !0, 'nodeValue'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   16     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $3
   19    10        INIT_FCALL                                               'var_dump'
         11        FETCH_OBJ_R                                      ~6      !0, 'nodeValue'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'var_dump'
         15        GET_CLASS                                        ~8      !1
         16        SEND_VAL                                                 ~8
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qa6EP
function name:  foo
number of ops:  26
compiled vars:  !0 = $d, !1 = $c, !2 = $g, !3 = $h
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_GLOBAL                                              !0, 'd'
    5     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
    6     4        INIT_METHOD_CALL                                         !0, 'createDocumentFragment'
          5        DO_FCALL                                      0  $7      
          6        ASSIGN                                                   !1, $7
    7     7        INIT_METHOD_CALL                                         !0, 'createElement'
          8        SEND_VAL_EX                                              'fiz'
          9        SEND_VAL_EX                                              'buz'
         10        DO_FCALL                                      0  $9      
         11        ASSIGN                                                   !2, $9
    8    12        INIT_METHOD_CALL                                         !0, 'createElement'
         13        SEND_VAL_EX                                              'red'
         14        SEND_VAL_EX                                              'xen'
         15        DO_FCALL                                      0  $11     
         16        ASSIGN                                                   !3, $11
   10    17        INIT_METHOD_CALL                                         !1, 'appendChild'
         18        SEND_VAR_EX                                              !2
         19        DO_FCALL                                      0          
   11    20        INIT_METHOD_CALL                                         !1, 'appendChild'
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0          
   13    23        FETCH_OBJ_R                                      ~15     !1, 'childNodes'
         24      > RETURN                                                   ~15
   14    25*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.55 ms | 1403 KiB | 16 Q