3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a{ static protected $test="class a"; public function static_test(){ echo static::$test; // Results class b echo self::$test; // Results class a } } class b extends a{ static protected $test="class b"; } $obj = new b(); $obj->static_test(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vPIEq
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'b'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'static_test'
          4        DO_FCALL                                      0          
   23     5      > RETURN                                                   1

Class a:
Function static_test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vPIEq
function name:  static_test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'test'
          1        ECHO                                                     ~0
    9     2        FETCH_STATIC_PROP_R          unknown             ~1      'test'
          3        ECHO                                                     ~1
   11     4      > RETURN                                                   null

End of function static_test

End of class a.

Class b:
Function static_test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vPIEq
function name:  static_test
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'test'
          1        ECHO                                                     ~0
    9     2        FETCH_STATIC_PROP_R          unknown             ~1      'test'
          3        ECHO                                                     ~1
   11     4      > RETURN                                                   null

End of function static_test

End of class b.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.84 ms | 1394 KiB | 13 Q