3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function getSomething(): self { return $this; } } class B extends A { public function getSomething(): self { return new A(); } } (new B)->getSomething();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLDaH
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $0      'B'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'getSomething'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   1

Class A:
Function getsomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLDaH
function name:  getSomething
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                       ~0      
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
    6     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function getsomething

End of class A.

Class B:
Function getsomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YLDaH
function name:  getSomething
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $0      'A'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   13     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function getsomething

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.37 ms | 1393 KiB | 13 Q