3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { static $bar; if ( !$bar ) { $bar = 123; } var_dump($bar); } foo(); $refl = new ReflectionFunction( 'foo' ); $statics = $refl->getStaticVariables(); $statics['bar'] = 456; foo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7hgsU
function name:  (null)
number of ops:  14
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        ASSIGN_DIM                                               !1, 'bar'
         10        OP_DATA                                                  456
   15    11        INIT_FCALL                                               'foo'
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
filename:       /in/7hgsU
function name:  foo
number of ops:  8
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, ->4
    6     3    >   ASSIGN                                                   !0, 123
    8     4    >   INIT_FCALL                                               'var_dump'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                                 
    9     7      > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.8 ms | 1398 KiB | 17 Q