3v4l.org

run code in 300+ PHP versions simultaneously
<?php $refVariable = false; $refName = 'refVariable'; $callback = function() use (&$refVariable) { static $foo = refVariable; var_dump($refVariable); var_dump($foo); }; $function = new \ReflectionFunction($callback); $staticVariables = $function->getStaticVariables(); $callback(); $staticVariables['foo'] = 8; $callback();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZRRcn
function name:  (null)
number of ops:  19
compiled vars:  !0 = $refVariable, !1 = $refName, !2 = $callback, !3 = $function, !4 = $staticVariables
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <false>
    4     1        ASSIGN                                                   !1, 'refVariable'
    5     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZRRcn%3A5%240'
          3        BIND_LEXICAL                                             ~7, !0
          4        ASSIGN                                                   !2, ~7
    6     5        NEW                                              $9      'ReflectionFunction'
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !3, $9
    7     9        INIT_METHOD_CALL                                         !3, 'getStaticVariables'
         10        DO_FCALL                                      0  $12     
         11        ASSIGN                                                   !4, $12
    8    12        INIT_DYNAMIC_CALL                                        !2
         13        DO_FCALL                                      0          
    9    14        ASSIGN_DIM                                               !4, 'foo'
         15        OP_DATA                                                  8
   10    16        INIT_DYNAMIC_CALL                                        !2
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FZRRcn%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZRRcn
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $refVariable, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
          5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FZRRcn%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.63 ms | 1396 KiB | 15 Q