3v4l.org

run code in 300+ PHP versions simultaneously
<?php $called = 0; $iterateOverArray = function ($array) use (&$called) { $pointer = 0; $called++; while (isset($array[$pointer])) { yield array($array[$pointer++], $called); } }; $iterator = $iterateOverArray([1,2,3,4,5]); dd($iterator);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZEONj
function name:  (null)
number of ops:  12
compiled vars:  !0 = $called, !1 = $iterateOverArray, !2 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
    5     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZEONj%3A5%240'
          2        BIND_LEXICAL                                             ~4, !0
          3        ASSIGN                                                   !1, ~4
   15     4        INIT_DYNAMIC_CALL                                        !1
          5        SEND_VAL_EX                                              <array>
          6        DO_FCALL                                      0  $6      
          7        ASSIGN                                                   !2, $6
   16     8        INIT_FCALL_BY_NAME                                       'dd'
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FZEONj%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 6
Branch analysis from position: 13
Branch analysis from position: 6
filename:       /in/ZEONj
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $array, !1 = $called, !2 = $pointer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
          2        BIND_STATIC                                              !1
    6     3        ASSIGN                                                   !2, 0
    7     4        PRE_INC                                                  !1
    9     5      > JMP                                                      ->11
   10     6    >   POST_INC                                         ~5      !2
          7        FETCH_DIM_R                                      ~6      !0, ~5
          8        INIT_ARRAY                                       ~7      ~6
          9        ADD_ARRAY_ELEMENT                                ~7      !1
         10        YIELD                                                    ~7
    9    11    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !2
         12      > JMPNZ                                                    ~9, ->6
   12    13    > > GENERATOR_RETURN                                         

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.62 ms | 1395 KiB | 13 Q