3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($x,$y) { echo "$x,$y"; } $funs = array(); for ($i=0; $i<10; $i++) { $funs[] = function($j) { f($i,$j); }; } for ($i=0; $i<10; $i++) { $g = $funs[$i]; $g(1); }
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 = 3
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 11
Branch analysis from position: 19
Branch analysis from position: 11
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 3
Branch analysis from position: 9
Branch analysis from position: 3
filename:       /in/9VnP9
function name:  (null)
number of ops:  20
compiled vars:  !0 = $funs, !1 = $i, !2 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->7
    9     3    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9VnP9%3A9%240'
          4        ASSIGN_DIM                                               !0
          5        OP_DATA                                                  ~6
    8     6        PRE_INC                                                  !1
          7    >   IS_SMALLER                                               !1, 10
          8      > JMPNZ                                                    ~8, ->3
   12     9    >   ASSIGN                                                   !1, 0
         10      > JMP                                                      ->17
   13    11    >   FETCH_DIM_R                                      ~10     !0, !1
         12        ASSIGN                                                   !2, ~10
   14    13        INIT_DYNAMIC_CALL                                        !2
         14        SEND_VAL_EX                                              1
         15        DO_FCALL                                      0          
   12    16        PRE_INC                                                  !1
         17    >   IS_SMALLER                                               !1, 10
         18      > JMPNZ                                                    ~14, ->11
   15    19    > > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9VnP9
function name:  f
number of ops:  7
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ROPE_INIT                                     3  ~3      !0
          3        ROPE_ADD                                      1  ~3      ~3, '%2C'
          4        ROPE_END                                      2  ~2      ~3, !1
          5        ECHO                                                     ~2
    5     6      > RETURN                                                   null

End of function f

Function %00%7Bclosure%7D%2Fin%2F9VnP9%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9VnP9
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $j, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'f'
          2        SEND_VAR                                                 !1
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0          
          5      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9VnP9%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.4 ms | 1403 KiB | 14 Q