3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { function TestSelf(): self { return new self(); } function TestStatic(): self { return new static(); } function ShowType(){ printf("%s\n", get_class($this)); } } class B extends A { function More() {} } (new B)->TestSelf()->ShowType(); (new B)->TestStatic()->ShowType();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WjC22
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   NEW                                                  $0      'B'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'TestSelf'
          3        DO_FCALL                                          0  $2      
          4        INIT_METHOD_CALL                                             $2, 'ShowType'
          5        DO_FCALL                                          0          
   19     6        NEW                                                  $4      'B'
          7        DO_FCALL                                          0          
          8        INIT_METHOD_CALL                                             $4, 'TestStatic'
          9        DO_FCALL                                          0  $6      
         10        INIT_METHOD_CALL                                             $6, 'ShowType'
         11        DO_FCALL                                          0          
         12      > RETURN                                                       1

Class A:
Function testself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WjC22
function name:  TestSelf
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 testself

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

End of function teststatic

Function showtype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WjC22
function name:  ShowType
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                                   'printf'
          1        SEND_VAL                                                     '%25s%0A'
          2        FETCH_THIS                                           ~0      
          3        GET_CLASS                                            ~1      ~0
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                                     
   12     6      > RETURN                                                       null

End of function showtype

End of class A.

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

End of function more

Function testself:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WjC22
function name:  TestSelf
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 testself

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

End of function teststatic

Function showtype:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WjC22
function name:  ShowType
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                                   'printf'
          1        SEND_VAL                                                     '%25s%0A'
          2        FETCH_THIS                                           ~0      
          3        GET_CLASS                                            ~1      ~0
          4        SEND_VAL                                                     ~1
          5        DO_ICALL                                                     
   12     6      > RETURN                                                       null

End of function showtype

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
202.99 ms | 2181 KiB | 14 Q