3v4l.org

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

Class A:
Function dump:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lg5pG
function name:  dump
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GET_CALLED_CLASS                                 ~0      
          1        ECHO                                                     ~0
    7     2      > RETURN                                                   null

End of function dump

End of class A.

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

End of function dump

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.01 ms | 1394 KiB | 13 Q