3v4l.org

run code in 300+ PHP versions simultaneously
<?php for ($i = 1; $i < 10; $i++) { $context = get_defined_vars(); $functions[$i] = function ($a) use ($context) { extract($context); return $a + $i; }; } echo $functions[4](7);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/W6T9Y
function name:  (null)
number of ops:  18
compiled vars:  !0 = $i, !1 = $context, !2 = $functions
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->10
    4     2    >   INIT_FCALL                                               'get_defined_vars'
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !1, $4
    5     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FW6T9Y%3A5%240'
          6        BIND_LEXICAL                                             ~7, !1
          7        ASSIGN_DIM                                               !2, !0
    8     8        OP_DATA                                                  ~7
    3     9        PRE_INC                                                  !0
         10    >   IS_SMALLER                                               !0, 10
         11      > JMPNZ                                                    ~9, ->2
   11    12    >   FETCH_DIM_R                                      ~10     !2, 4
         13        INIT_DYNAMIC_CALL                                        ~10
         14        SEND_VAL_EX                                              7
         15        DO_FCALL                                      0  $11     
         16        ECHO                                                     $11
         17      > RETURN                                                   1

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

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.38 ms | 1396 KiB | 17 Q