3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { const FOO = 42; public static function getSelf() { return self::FOO; } public static function getStatic() { return static::FOO; } } class B extends A { const FOO = 37; } var_dump(A::FOO); // 42 var_dump(B::FOO); // 37 var_dump(A::getSelf()); // 42 var_dump(A::getStatic()); // 42 var_dump(B::getSelf()); // 42 var_dump(B::getStatic()); // 37
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rUqs4
function name:  (null)
number of ops:  27
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 42
          2        DO_ICALL                                                 
   19     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAL                                                 37
          5        DO_ICALL                                                 
   20     6        INIT_FCALL                                               'var_dump'
          7        INIT_STATIC_METHOD_CALL                                  'A', 'getSelf'
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                                 
   21    11        INIT_FCALL                                               'var_dump'
         12        INIT_STATIC_METHOD_CALL                                  'A', 'getStatic'
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                                 
   22    16        INIT_FCALL                                               'var_dump'
         17        INIT_STATIC_METHOD_CALL                                  'B', 'getSelf'
         18        DO_FCALL                                      0  $6      
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                                 
   23    21        INIT_FCALL                                               'var_dump'
         22        INIT_STATIC_METHOD_CALL                                  'B', 'getStatic'
         23        DO_FCALL                                      0  $8      
         24        SEND_VAR                                                 $8
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

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

End of function getself

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

End of function getstatic

End of class A.

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

End of function getself

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

End of function getstatic

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.65 ms | 1400 KiB | 15 Q