3v4l.org

run code in 300+ PHP versions simultaneously
<?php function chain($input) { foreach ($input as $arr) { foreach ($arr as $v) { yield $v; } } } $it = chain([ ['a', 'b'], ['c', 'd', 'e'], ['f', 'g', 'h', 'i'] ]); echo implode(', ', iterator_to_array($it));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mUDjV
function name:  (null)
number of ops:  13
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'chain'
   11     1        SEND_VAL                                                 <array>
          2        DO_FCALL                                      0  $1      
   10     3        ASSIGN                                                   !0, $1
   16     4        INIT_FCALL                                               'implode'
          5        SEND_VAL                                                 '%2C+'
          6        INIT_FCALL                                               'iterator_to_array'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                         $4      
         11        ECHO                                                     $4
         12      > RETURN                                                   1

Function chain:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 10
filename:       /in/mUDjV
function name:  chain
number of ops:  12
compiled vars:  !0 = $input, !1 = $arr, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    3     2      > FE_RESET_R                                       $3      !0, ->10
          3    > > FE_FETCH_R                                               $3, !1, ->10
    4     4    > > FE_RESET_R                                       $4      !1, ->8
          5    > > FE_FETCH_R                                               $4, !2, ->8
    5     6    >   YIELD                                                    !2
    4     7      > JMP                                                      ->5
          8    >   FE_FREE                                                  $4
    3     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $3
    8    11      > GENERATOR_RETURN                                         

End of function chain

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.49 ms | 1398 KiB | 18 Q