3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo = 'foo'; public function iterate(Foo $thing) { $r = []; foreach ($thing as $prop) { $r[] = $prop; } return $r; } } class Bar extends Foo { protected $bar = 'bar'; } class Baz extends Foo { protected $baz = 'baz'; } var_dump((new Foo)->iterate(new Foo)); var_dump((new Bar)->iterate(new Bar)); var_dump((new Baz)->iterate(new Baz)); var_dump((new Bar)->iterate(new Baz)); var_dump((new Baz)->iterate(new Bar));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/64eh3
function name:  (null)
number of ops:  51
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        NEW                                              $2      'Foo'
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $2
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
   30    10        INIT_FCALL                                               'var_dump'
         11        NEW                                              $6      'Bar'
         12        DO_FCALL                                      0          
         13        INIT_METHOD_CALL                                         $6, 'iterate'
         14        NEW                                              $8      'Bar'
         15        DO_FCALL                                      0          
         16        SEND_VAR_NO_REF_EX                                       $8
         17        DO_FCALL                                      0  $10     
         18        SEND_VAR                                                 $10
         19        DO_ICALL                                                 
   31    20        INIT_FCALL                                               'var_dump'
         21        NEW                                              $12     'Baz'
         22        DO_FCALL                                      0          
         23        INIT_METHOD_CALL                                         $12, 'iterate'
         24        NEW                                              $14     'Baz'
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $14
         27        DO_FCALL                                      0  $16     
         28        SEND_VAR                                                 $16
         29        DO_ICALL                                                 
   32    30        INIT_FCALL                                               'var_dump'
         31        NEW                                              $18     'Bar'
         32        DO_FCALL                                      0          
         33        INIT_METHOD_CALL                                         $18, 'iterate'
         34        NEW                                              $20     'Baz'
         35        DO_FCALL                                      0          
         36        SEND_VAR_NO_REF_EX                                       $20
         37        DO_FCALL                                      0  $22     
         38        SEND_VAR                                                 $22
         39        DO_ICALL                                                 
   33    40        INIT_FCALL                                               'var_dump'
         41        NEW                                              $24     'Baz'
         42        DO_FCALL                                      0          
         43        INIT_METHOD_CALL                                         $24, 'iterate'
         44        NEW                                              $26     'Bar'
         45        DO_FCALL                                      0          
         46        SEND_VAR_NO_REF_EX                                       $26
         47        DO_FCALL                                      0  $28     
         48        SEND_VAR                                                 $28
         49        DO_ICALL                                                 
         50      > 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/64eh3
function name:  iterate
number of ops:  10
compiled vars:  !0 = $thing, !1 = $r, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                               $4, !2, ->7
   12     4    >   ASSIGN_DIM                                               !1
          5        OP_DATA                                                  !2
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !1
   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/64eh3
function name:  iterate
number of ops:  10
compiled vars:  !0 = $thing, !1 = $r, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                               $4, !2, ->7
   12     4    >   ASSIGN_DIM                                               !1
          5        OP_DATA                                                  !2
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !1
   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/64eh3
function name:  iterate
number of ops:  10
compiled vars:  !0 = $thing, !1 = $r, !2 = $prop
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $4      !0, ->7
          3    > > FE_FETCH_R                                               $4, !2, ->7
   12     4    >   ASSIGN_DIM                                               !1
          5        OP_DATA                                                  !2
   11     6      > JMP                                                      ->3
          7    >   FE_FREE                                                  $4
   15     8      > RETURN                                                   !1
   16     9*     > RETURN                                                   null

End of function iterate

End of class Baz.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.92 ms | 1404 KiB | 15 Q