3v4l.org

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

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

End of function get_self

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

End of function get_static

End of class A.

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

End of function get_self

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

End of function get_static

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.03 ms | 1399 KiB | 13 Q