3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { static $bar; if ( !$bar ) { $bar = (object)123; } var_dump($bar->scalar); } foo(); $refl = new ReflectionFunction( 'foo' ); $statics = $refl->getStaticVariables(); $statics['bar']->scalar = 456; foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Aa84b
function name:  (null)
number of ops:  15
compiled vars:  !0 = $refl, !1 = $statics
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0          
   12     2        NEW                                              $3      'ReflectionFunction'
          3        SEND_VAL_EX                                              'foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $3
   13     6        INIT_METHOD_CALL                                         !0, 'getStaticVariables'
          7        DO_FCALL                                      0  $6      
          8        ASSIGN                                                   !1, $6
   14     9        FETCH_DIM_W                                      $8      !1, 'bar'
         10        ASSIGN_OBJ                                               $8, 'scalar'
         11        OP_DATA                                                  456
   15    12        INIT_FCALL                                               'foo'
         13        DO_FCALL                                      0          
         14      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/Aa84b
function name:  foo
number of ops:  10
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   BIND_STATIC                                              !0
    5     1        BOOL_NOT                                         ~1      !0
          2      > JMPZ                                                     ~1, ->5
    6     3    >   CAST                                          8  ~2      123
          4        ASSIGN                                                   !0, ~2
    8     5    >   INIT_FCALL                                               'var_dump'
          6        FETCH_OBJ_R                                      ~4      !0, 'scalar'
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
    9     9      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.4 ms | 1398 KiB | 17 Q