3v4l.org

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

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

End of function withself

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

End of function withstatic

End of class A.

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

End of function withself

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

End of function withstatic

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
181.93 ms | 1409 KiB | 14 Q