3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public static $a = array(); public function test($key, $value) { self::$a[$key] = $value; var_dump(self::class); } } class B extends A { public static $a = array(); } class C extends A { public static $a = array(); } $b = new B; $b->test('waa', 'meukee'); var_dump($b::$a); $c = new C; $c->test('waa123', 'meukee123'); var_dump($c::$a); var_dump(A::$a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zsaev
function name:  (null)
number of ops:  29
compiled vars:  !0 = $b, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   25     3        INIT_METHOD_CALL                                         !0, 'test'
          4        SEND_VAL_EX                                              'waa'
          5        SEND_VAL_EX                                              'meukee'
          6        DO_FCALL                                      0          
   26     7        INIT_FCALL                                               'var_dump'
          8        FETCH_CLASS                                   0  $6      !0
          9        FETCH_STATIC_PROP_R          unknown             ~7      'a'
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
   28    12        NEW                                              $9      'C'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $9
   29    15        INIT_METHOD_CALL                                         !1, 'test'
         16        SEND_VAL_EX                                              'waa123'
         17        SEND_VAL_EX                                              'meukee123'
         18        DO_FCALL                                      0          
   30    19        INIT_FCALL                                               'var_dump'
         20        FETCH_CLASS                                   0  $13     !1
         21        FETCH_STATIC_PROP_R          unknown             ~14     'a'
         22        SEND_VAL                                                 ~14
         23        DO_ICALL                                                 
   31    24        INIT_FCALL                                               'var_dump'
         25        FETCH_STATIC_PROP_R          unknown             ~16     'a'
         26        SEND_VAL                                                 ~16
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zsaev
function name:  test
number of ops:  9
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_STATIC_PROP_W          global              $2      'a'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   10     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAL                                                 'A'
          7        DO_ICALL                                                 
   11     8      > RETURN                                                   null

End of function test

End of class A.

Class B:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zsaev
function name:  test
number of ops:  9
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_STATIC_PROP_W          global              $2      'a'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   10     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAL                                                 'A'
          7        DO_ICALL                                                 
   11     8      > RETURN                                                   null

End of function test

End of class B.

Class C:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zsaev
function name:  test
number of ops:  9
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        FETCH_STATIC_PROP_W          global              $2      'a'
          3        ASSIGN_DIM                                               $2, !0
          4        OP_DATA                                                  !1
   10     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAL                                                 'A'
          7        DO_ICALL                                                 
   11     8      > RETURN                                                   null

End of function test

End of class C.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.06 ms | 1400 KiB | 15 Q