3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bar { public function test() { return "Bar"; } } class BarX extends Bar { public function test() { return "BarX"; } } class A { public function foo(): Bar { //some ops $bar = new Bar; return $bar; //'Bar' object } } class B extends A { public function foo(): Bar { $barX = new BarX; return $barX; //'BarX' object } } $t = new B; echo $t->foo()->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJaVE
function name:  (null)
number of ops:  9
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   31     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0  $4      
          5        INIT_METHOD_CALL                                         $4, 'test'
          6        DO_FCALL                                      0  $5      
          7        ECHO                                                     $5
          8      > RETURN                                                   1

Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJaVE
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E > > RETURN                                                   'Bar'
    6     1*     > RETURN                                                   null

End of function test

End of class Bar.

Class BarX:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJaVE
function name:  test
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E > > RETURN                                                   'BarX'
   12     1*     > RETURN                                                   null

End of function test

End of class BarX.

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJaVE
function name:  foo
number of ops:  7
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        VERIFY_RETURN_TYPE                                       !0
          4      > RETURN                                                   !0
   20     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lJaVE
function name:  foo
number of ops:  7
compiled vars:  !0 = $barX
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'BarX'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        VERIFY_RETURN_TYPE                                       !0
          4      > RETURN                                                   !0
   27     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.79 ms | 1399 KiB | 13 Q