3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { const X = 1 + self::Z; const Y = 1 - self::Z; const Z = self::Z; function f() { echo static::X; echo static::Y; echo static::Z; } } class B extends A { const Z = 1; } (new B)->f();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5aYB5
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $0      'B'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'f'
          3        DO_FCALL                                          0          
          4      > RETURN                                                       1

Class A:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5aYB5
function name:  f
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_CLASS_CONSTANT                                 ~0      'X'
          1        ECHO                                                         ~0
   10     2        FETCH_CLASS_CONSTANT                                 ~1      'Y'
          3        ECHO                                                         ~1
   11     4        FETCH_CLASS_CONSTANT                                 ~2      'Z'
          5        ECHO                                                         ~2
   12     6      > RETURN                                                       null

End of function f

End of class A.

Class B:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5aYB5
function name:  f
number of ops:  7
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   FETCH_CLASS_CONSTANT                                 ~0      'X'
          1        ECHO                                                         ~0
   10     2        FETCH_CLASS_CONSTANT                                 ~1      'Y'
          3        ECHO                                                         ~1
   11     4        FETCH_CLASS_CONSTANT                                 ~2      'Z'
          5        ECHO                                                         ~2
   12     6      > RETURN                                                       null

End of function f

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
156.65 ms | 2266 KiB | 13 Q