3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected static $staticProp = 0; public function nonstaticWillDelegateToStatic() { static::staticfunction(); } public static function staticWillDelegateToNonstatic() { static::nonstaticfunction(); } public function nonstaticfunction() { var_dump(static::$staticProp); } public static function staticfunction() { static::$staticProp++; } } Foo:staticfunction(); $foo = new Foo(); $foo->staticWillDelegateToNonstatic();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLT2r
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL_BY_NAME                                       'staticfunction'
          1        DO_FCALL                                      0          
   30     2        NEW                                              $2      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   31     5        INIT_METHOD_CALL                                         !0, 'staticWillDelegateToNonstatic'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class Foo:
Function nonstaticwilldelegatetostatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLT2r
function name:  nonstaticWillDelegateToStatic
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_STATIC_METHOD_CALL                                  'staticfunction'
          1        DO_FCALL                                      0          
   11     2      > RETURN                                                   null

End of function nonstaticwilldelegatetostatic

Function staticwilldelegatetononstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLT2r
function name:  staticWillDelegateToNonstatic
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_STATIC_METHOD_CALL                                  'nonstaticfunction'
          1        DO_FCALL                                      0          
   16     2      > RETURN                                                   null

End of function staticwilldelegatetononstatic

Function nonstaticfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLT2r
function name:  nonstaticfunction
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_STATIC_PROP_R          global lock         ~0      'staticProp'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
   21     4      > RETURN                                                   null

End of function nonstaticfunction

Function staticfunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QLT2r
function name:  staticfunction
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   PRE_INC_STATIC_PROP                                      'staticProp'
   26     1      > RETURN                                                   null

End of function staticfunction

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.56 ms | 1396 KiB | 15 Q