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/B3WR9
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   DECLARE_CLASS                                            'bar', 'foo'
   21     1        ASSIGN_STATIC_PROP                                       'db', 'bar'
          2        OP_DATA                                                  5
   23     3        INIT_FCALL                                               'var_dump'
          4        FETCH_STATIC_PROP_R          unknown             ~1      'db'
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                                 
   27     7      > RETURN                                                   1

Class t:
Function dump:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3WR9
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:
141.66 ms | 1386 KiB | 17 Q