3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const U = 'Y'; public static function getStatic(){ return static::U; } public static function getSelf(){ return self::U; } } class B extends A { const U = 'X'; } echo "static::U gives: " . B::getStatic() . "\n"; echo "self::U gives: " . B::getSelf() . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9sISN
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_STATIC_METHOD_CALL                                  'B', 'getStatic'
          1        DO_FCALL                                      0  $0      
          2        CONCAT                                           ~1      'static%3A%3AU+gives%3A+', $0
          3        CONCAT                                           ~2      ~1, '%0A'
          4        ECHO                                                     ~2
   22     5        INIT_STATIC_METHOD_CALL                                  'B', 'getSelf'
          6        DO_FCALL                                      0  $3      
          7        CONCAT                                           ~4      'self%3A%3AU+gives%3A+', $3
          8        CONCAT                                           ~5      ~4, '%0A'
          9        ECHO                                                     ~5
         10      > RETURN                                                   1

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

End of function getstatic

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

End of function getself

End of class A.

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

End of function getstatic

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

End of function getself

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.25 ms | 1395 KiB | 13 Q