3v4l.org

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

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

End of function %00%7Bclosure%7D%2Fin%2FgkXkl%3A3%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.88 ms | 1394 KiB | 13 Q