3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function test() { static $v = []; $v[] = 'x'; } } $r = new \ReflectionMethod(A::class, 'test'); print_r($r->getStaticVariables()); $a = new A(); $a->test(); print_r($r->getStaticVariables()); $a->test(); print_r($r->getStaticVariables()); $r->getStaticVariables()['v'][0] = ['replace_first_x']; print_r($r->getStaticVariables()); $a->test(); print_r($r->getStaticVariables());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e67fY
function name:  (null)
number of ops:  46
compiled vars:  !0 = $r, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'ReflectionMethod'
          1        SEND_VAL_EX                                              'A'
          2        SEND_VAL_EX                                              'test'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $2
   13     5        INIT_FCALL                                               'print_r'
          6        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
   15    10        NEW                                              $7      'A'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $7
   16    13        INIT_METHOD_CALL                                         !1, 'test'
         14        DO_FCALL                                      0          
   17    15        INIT_FCALL                                               'print_r'
         16        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
         17        DO_FCALL                                      0  $11     
         18        SEND_VAR                                                 $11
         19        DO_ICALL                                                 
   18    20        INIT_METHOD_CALL                                         !1, 'test'
         21        DO_FCALL                                      0          
   19    22        INIT_FCALL                                               'print_r'
         23        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
         24        DO_FCALL                                      0  $14     
         25        SEND_VAR                                                 $14
         26        DO_ICALL                                                 
   21    27        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
         28        DO_FCALL                                      0  $16     
         29        SEPARATE                                         $16     $16
         30        FETCH_DIM_W                                      $17     $16, 'v'
         31        ASSIGN_DIM                                               $17, 0
         32        OP_DATA                                                  <array>
   22    33        INIT_FCALL                                               'print_r'
         34        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
         35        DO_FCALL                                      0  $19     
         36        SEND_VAR                                                 $19
         37        DO_ICALL                                                 
   24    38        INIT_METHOD_CALL                                         !1, 'test'
         39        DO_FCALL                                      0          
   25    40        INIT_FCALL                                               'print_r'
         41        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
         42        DO_FCALL                                      0  $22     
         43        SEND_VAR                                                 $22
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e67fY
function name:  test
number of ops:  4
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    8     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  'x'
    9     3      > RETURN                                                   null

End of function test

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
210.72 ms | 1005 KiB | 14 Q