3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo(): Generator { $i = range('a', 'd'); $j = range('e', 'g'); foreach ([$i, $j] as $item) { yield from $item; } } var_dump(iterator_to_array(foo()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pcSrK
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_FCALL                                                   'iterator_to_array'
          2        INIT_FCALL                                                   'foo'
          3        DO_FCALL                                          0  $0      
          4        SEND_VAR                                                     $0
          5        DO_ICALL                                             $1      
          6        SEND_VAR                                                     $1
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 18
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 18
filename:       /in/pcSrK
function name:  foo
number of ops:  20
compiled vars:  !0 = $i, !1 = $j, !2 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                             
    4     1        INIT_FCALL                                                   'range'
          2        SEND_VAL                                                     'a'
          3        SEND_VAL                                                     'd'
          4        DO_ICALL                                             $3      
          5        ASSIGN                                                       !0, $3
    5     6        INIT_FCALL                                                   'range'
          7        SEND_VAL                                                     'e'
          8        SEND_VAL                                                     'g'
          9        DO_ICALL                                             $5      
         10        ASSIGN                                                       !1, $5
    7    11        INIT_ARRAY                                           ~7      !0
         12        ADD_ARRAY_ELEMENT                                    ~7      !1
         13      > FE_RESET_R                                           $8      ~7, ->18
         14    > > FE_FETCH_R                                                   $8, !2, ->18
    8    15    >   YIELD_FROM                                           ~9      !2
         16        FREE                                                         ~9
    7    17      > JMP                                                          ->14
         18    >   FE_FREE                                                      $8
   10    19      > GENERATOR_RETURN                                             

End of function foo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.07 ms | 510 KiB | 13 Q