3v4l.org

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

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

End of function getthis

End of class A.

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

End of function getthis

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.26 ms | 1395 KiB | 15 Q