3v4l.org

run code in 300+ PHP versions simultaneously
<?php class cA { /** * Test property for using direct default value */ protected static $item = 'Foo'; /** * Test property for using indirect default value */ protected static $other = 'cA'; public static function method() { print self::$item."\r\n"; // It prints 'Foo' on everyway... :( print self::$other."\r\n"; // We just think that, this one prints 'cA' only, but... :) } public static function setOther($val) { self::$other = $val; // Set a value in this scope. } } class cB extends cA { /** * Test property with redefined default value */ protected static $item = 'Bar'; } //cB::setOther('cB'); // It's cB::method()! cB::method(); // It's cA::method()!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQsQB
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   INIT_STATIC_METHOD_CALL                                  'cB', 'method'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Class cA:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQsQB
function name:  method
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'item'
          1        CONCAT                                           ~1      ~0, '%0D%0A'
          2        ECHO                                                     ~1
   18     3        FETCH_STATIC_PROP_R          unknown             ~2      'other'
          4        CONCAT                                           ~3      ~2, '%0D%0A'
          5        ECHO                                                     ~3
   19     6      > RETURN                                                   null

End of function method

Function setother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQsQB
function name:  setOther
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        ASSIGN_STATIC_PROP                                       'other'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function setother

End of class cA.

Class cB:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQsQB
function name:  method
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_STATIC_PROP_R          unknown             ~0      'item'
          1        CONCAT                                           ~1      ~0, '%0D%0A'
          2        ECHO                                                     ~1
   18     3        FETCH_STATIC_PROP_R          unknown             ~2      'other'
          4        CONCAT                                           ~3      ~2, '%0D%0A'
          5        ECHO                                                     ~3
   19     6      > RETURN                                                   null

End of function method

Function setother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PQsQB
function name:  setOther
number of ops:  4
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        ASSIGN_STATIC_PROP                                       'other'
          2        OP_DATA                                                  !0
   24     3      > RETURN                                                   null

End of function setother

End of class cB.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.29 ms | 1399 KiB | 13 Q