3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo = 'foo'; public function iterate() { $r = []; foreach ($this as $thing) { $r[] = $thing; } return $r; } } class Bar extends Foo { protected $bar = 'bar'; } class Baz extends Foo { protected $baz = 'baz'; } var_dump((new Foo)->iterate()); var_dump((new Bar)->iterate()); var_dump((new Baz)->iterate());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/scqEC
function name:  (null)
number of ops:  22
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'iterate'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
   30     7        INIT_FCALL                                               'var_dump'
          8        NEW                                              $4      'Bar'
          9        DO_FCALL                                      0          
         10        INIT_METHOD_CALL                                         $4, 'iterate'
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                                 
   31    14        INIT_FCALL                                               'var_dump'
         15        NEW                                              $8      'Baz'
         16        DO_FCALL                                      0          
         17        INIT_METHOD_CALL                                         $8, 'iterate'
         18        DO_FCALL                                      0  $10     
         19        SEND_VAR                                                 $10
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Class Foo:
Function iterate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/scqEC
function name:  iterate
number of ops:  10
compiled vars:  !0 = $r, !1 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   11     1        FETCH_THIS                                       ~3      
          2      > FE_RESET_R                                       $4      ~3, ->7
          3    > > FE_FETCH_R                                               $4, !1, ->7
   12     4    >   ASSIGN_DIM                                               !0
          5        OP_DATA                                                  !1
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !0
   16     9*     > RETURN                                                   null

End of function iterate

End of class Foo.

Class Bar:
Function iterate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/scqEC
function name:  iterate
number of ops:  10
compiled vars:  !0 = $r, !1 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   11     1        FETCH_THIS                                       ~3      
          2      > FE_RESET_R                                       $4      ~3, ->7
          3    > > FE_FETCH_R                                               $4, !1, ->7
   12     4    >   ASSIGN_DIM                                               !0
          5        OP_DATA                                                  !1
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !0
   16     9*     > RETURN                                                   null

End of function iterate

End of class Bar.

Class Baz:
Function iterate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/scqEC
function name:  iterate
number of ops:  10
compiled vars:  !0 = $r, !1 = $thing
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   11     1        FETCH_THIS                                       ~3      
          2      > FE_RESET_R                                       $4      ~3, ->7
          3    > > FE_FETCH_R                                               $4, !1, ->7
   12     4    >   ASSIGN_DIM                                               !0
          5        OP_DATA                                                  !1
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !0
   16     9*     > RETURN                                                   null

End of function iterate

End of class Baz.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.8 ms | 1400 KiB | 15 Q