3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const MA_CONST = 1; public function get1() { return self::MA_CONST; } public function get2() { return static::MA_CONST; } } class B extends A { const MA_CONST = 2; } $o = new B(); var_dump($o->get1()); var_dump($o->get2()); var_dump(B::MA_CONST);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uRRH
function name:  (null)
number of ops:  17
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'get1'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   22     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'get2'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
   24    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAL                                                 2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

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

End of function get1

Function get2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uRRH
function name:  get2
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_CLASS_CONSTANT                             ~0      'MA_CONST'
          1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function get2

End of class A.

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

End of function get1

Function get2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uRRH
function name:  get2
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   FETCH_CLASS_CONSTANT                             ~0      'MA_CONST'
          1      > RETURN                                                   ~0
   12     2*     > RETURN                                                   null

End of function get2

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
202.96 ms | 1400 KiB | 15 Q