3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const MY_CONST = false; public function my_const_self() { return self::MY_CONST; } public function my_const_static() { return static::MY_CONST; } } class B extends A { const MY_CONST = true; } $b = new B(); echo $b->my_const_self ? 'yes' : 'no'; // output: no echo $b->my_const_static ? 'yes' : 'no'; // output: yes ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
Branch analysis from position: 13
filename:       /in/AoF4F
function name:  (null)
number of ops:  16
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   17     3        FETCH_OBJ_R                                      ~4      !0, 'my_const_self'
          4      > JMPZ                                                     ~4, ->7
          5    >   QM_ASSIGN                                        ~5      'yes'
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~5      'no'
          8    >   ECHO                                                     ~5
   18     9        FETCH_OBJ_R                                      ~6      !0, 'my_const_static'
         10      > JMPZ                                                     ~6, ->13
         11    >   QM_ASSIGN                                        ~7      'yes'
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~7      'no'
         14    >   ECHO                                                     ~7
   19    15      > RETURN                                                   1

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

End of function my_const_self

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

End of function my_const_static

End of class A.

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

End of function my_const_self

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

End of function my_const_static

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.37 ms | 1399 KiB | 13 Q