3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait t { public static $db = 15; public static function dump(){ print_r(array( get_called_class(), __CLASS__, __TRAIT__ )); } }; class foo { // use t; } class bar extends foo { use t; } foo::$db = 10; bar::$db = 5; var_dump(t::$db); //t::dump(); //foo::dump(); //bar::dump();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RpslQ
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'bar', 'foo'
   20     1        ASSIGN_STATIC_PROP                                       'db', 'foo'
          2        OP_DATA                                                  10
   21     3        ASSIGN_STATIC_PROP                                       'db', 'bar'
          4        OP_DATA                                                  5
   23     5        INIT_FCALL                                               'var_dump'
          6        FETCH_STATIC_PROP_R          unknown             ~2      'db'
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                                 
   27     9      > RETURN                                                   1

Class t:
Function dump:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RpslQ
function name:  dump
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   INIT_FCALL                                               'print_r'
    7     1        GET_CALLED_CLASS                                 ~0      
          2        INIT_ARRAY                                       ~1      ~0
    8     3        FETCH_CLASS_NAME                                 ~2      
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
    7     5        ADD_ARRAY_ELEMENT                                ~1      't'
          6        SEND_VAL                                                 ~1
          7        DO_ICALL                                                 
   11     8      > RETURN                                                   null

End of function dump

End of class t.

Class foo: [no user functions]
Class bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.78 ms | 1395 KiB | 17 Q