3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ParentClass { // whether it's abstract or not makes no difference public const TABLE = 'fallback_const_if_wanted'; public static string $table = 'fallback_var_if_wanted'; public static function demo() { echo 'self::TABLE is ', self::TABLE, "\n"; echo 'self::$table is ', self::$table, "\n"; echo 'static::TABLE is ', static::TABLE, "\n"; echo 'static::$table is ', static::$table, "\n"; } } class ChildClass extends ParentClass { public const TABLE = 'child_const'; public static string $table = 'child_var'; } ChildClass::demo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CblZr
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'ChildClass', 'demo'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Class ParentClass:
Function demo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CblZr
function name:  demo
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'self%3A%3ATABLE+is+'
          1        ECHO                                                     'fallback_const_if_wanted'
          2        ECHO                                                     '%0A'
    9     3        ECHO                                                     'self%3A%3A%24table+is+'
          4        FETCH_STATIC_PROP_R          unknown             ~0      'table'
          5        ECHO                                                     ~0
          6        ECHO                                                     '%0A'
   10     7        ECHO                                                     'static%3A%3ATABLE+is+'
          8        FETCH_CLASS_CONSTANT                             ~1      'TABLE'
          9        ECHO                                                     ~1
         10        ECHO                                                     '%0A'
   11    11        ECHO                                                     'static%3A%3A%24table+is+'
         12        FETCH_STATIC_PROP_R          unknown             ~2      'table'
         13        ECHO                                                     ~2
         14        ECHO                                                     '%0A'
   12    15      > RETURN                                                   null

End of function demo

End of class ParentClass.

Class ChildClass:
Function demo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CblZr
function name:  demo
number of ops:  16
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'self%3A%3ATABLE+is+'
          1        ECHO                                                     'fallback_const_if_wanted'
          2        ECHO                                                     '%0A'
    9     3        ECHO                                                     'self%3A%3A%24table+is+'
          4        FETCH_STATIC_PROP_R          unknown             ~0      'table'
          5        ECHO                                                     ~0
          6        ECHO                                                     '%0A'
   10     7        ECHO                                                     'static%3A%3ATABLE+is+'
          8        FETCH_CLASS_CONSTANT                             ~1      'TABLE'
          9        ECHO                                                     ~1
         10        ECHO                                                     '%0A'
   11    11        ECHO                                                     'static%3A%3A%24table+is+'
         12        FETCH_STATIC_PROP_R          unknown             ~2      'table'
         13        ECHO                                                     ~2
         14        ECHO                                                     '%0A'
   12    15      > RETURN                                                   null

End of function demo

End of class ChildClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.34 ms | 1000 KiB | 13 Q