3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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
Jump found. (Code = 62) Position 1 = -2
filename:       /in/9uRRH
function name:  (null)
number of ops:  20
compiled vars:  !0 = $o
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  15     1        NOP                                                      
         2        NOP                                                      
  19     3        NEW                                              $4      :-3
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !0, $4
  21     6        INIT_FCALL                                               'var_dump'
         7        INIT_METHOD_CALL                                         !0, 'get1'
         8        DO_FCALL                                      0  $7      
         9        SEND_VAR                                                 $7
        10        DO_ICALL                                                 
  22    11        INIT_FCALL                                               'var_dump'
        12        INIT_METHOD_CALL                                         !0, 'get2'
        13        DO_FCALL                                      0  $9      
        14        SEND_VAR                                                 $9
        15        DO_ICALL                                                 
  24    16        INIT_FCALL                                               'var_dump'
        17        SEND_VAL                                                 2
        18        DO_ICALL                                                 
        19      > RETURN                                                   1

Class A:
Function get1:
Finding entry points
Branch analysis from position: 0
Jump 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
Jump 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
Jump 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
Jump 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 7.2.0