3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static $bar = []; public static function foo($x) { static::$bar[] = $x; return static::$bar; } } class B extends A { public static function resetFoo() { static::$bar = []; } } print_r(A::foo(1)); print_r(A::foo(2)); B::resetFoo(); print_r(A::foo(3));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Bn0L
function name:  (null)
number of ops:  21
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_STATIC_METHOD_CALL                                  'A', 'foo'
          2        SEND_VAL                                                 1
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   20     6        INIT_FCALL                                               'print_r'
          7        INIT_STATIC_METHOD_CALL                                  'A', 'foo'
          8        SEND_VAL                                                 2
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   21    12        INIT_STATIC_METHOD_CALL                                  'B', 'resetFoo'
         13        DO_FCALL                                      0          
   22    14        INIT_FCALL                                               'print_r'
         15        INIT_STATIC_METHOD_CALL                                  'A', 'foo'
         16        SEND_VAL                                                 3
         17        DO_FCALL                                      0  $5      
         18        SEND_VAR                                                 $5
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Bn0L
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_STATIC_PROP_W          global              $1      'bar'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
    9     4        FETCH_STATIC_PROP_R          unknown             ~3      'bar'
          5      > RETURN                                                   ~3
   10     6*     > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function resetfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Bn0L
function name:  resetFoo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN_STATIC_PROP                                       'bar'
          1        OP_DATA                                                  <array>
   16     2      > RETURN                                                   null

End of function resetfoo

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Bn0L
function name:  foo
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        FETCH_STATIC_PROP_W          global              $1      'bar'
          2        ASSIGN_DIM                                               $1
          3        OP_DATA                                                  !0
    9     4        FETCH_STATIC_PROP_R          unknown             ~3      'bar'
          5      > RETURN                                                   ~3
   10     6*     > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.33 ms | 1400 KiB | 15 Q