3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen1() { yield 1; yield 2; } /** function yieldFrom() { $iter = gen1(); foreach($iter as $val) { yield $val; } } /**/ /**/ function gen2() { yield from gen1(); } /**/ $g = gen2(); foreach($g as $val) { var_dump($val); }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
Jump found. Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
Jump found. Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
Jump found. Position 1 = -2
Branch analysis from position: 11
filename:       /in/4vQ8l
function name:  (null)
number of ops:  13
compiled vars:  !0 = $g, !1 = $val
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  17     1        NOP                                                      
  22     2        INIT_FCALL                                               'gen2'
         3        DO_FCALL                                      0  $2      
         4        ASSIGN                                                   !0, $2
  23     5      > FE_RESET_R                                       $4      !0, ->11
         6    > > FE_FETCH_R                                               $4, !1, ->11
         7    >   INIT_FCALL                                               'var_dump'
         8        SEND_VAR                                                 !1
         9        DO_ICALL                                                 
        10      > JMP                                                      ->6
        11    >   FE_FREE                                                  $4
        12      > RETURN                                                   1

Function gen1:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/4vQ8l
function name:  gen1
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   YIELD                                                    1
   5     1        YIELD                                                    2
   6     2      > GENERATOR_RETURN                                         

End of function gen1

Function gen2:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/4vQ8l
function name:  gen2
number of ops:  5
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  18     0  E >   INIT_FCALL                                               'gen1'
         1        DO_FCALL                                      0  $0      
         2        RAISE_ABSTRACT_ERROR                             ~1      $0
         3        FREE                                                     ~1
  19     4      > GENERATOR_RETURN                                         

End of function gen2

Generated using Vulcan Logic Dumper, using php 7.1.0