3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public static function getSelfInstance() : self { return new self(); } /** @return static */ public static function getStaticInstance(): self { return new static(); } } class B extends A {} var_dump(get_class(B::getSelfInstance())); var_dump(get_class(B::getStaticInstance()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qaADH
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_STATIC_METHOD_CALL                                      'B', 'getSelfInstance'
          2        DO_FCALL                                          0  $0      
          3        GET_CLASS                                            ~1      $0
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                                     
   17     6        INIT_FCALL                                                   'var_dump'
          7        INIT_STATIC_METHOD_CALL                                      'B', 'getStaticInstance'
          8        DO_FCALL                                          0  $3      
          9        GET_CLASS                                            ~4      $3
         10        SEND_VAL                                                     ~4
         11        DO_ICALL                                                     
         12      > RETURN                                                       1

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

End of function getselfinstance

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

End of function getstaticinstance

End of class A.

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

End of function getselfinstance

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

End of function getstaticinstance

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.11 ms | 2107 KiB | 14 Q