3v4l.org

run code in 300+ PHP versions simultaneously
<?php function rave() { yield from one(); return yield from two(); } function one() { yield 1; } function two() { yield 2; return 3; } $gnrt = rave(); foreach ($gnrt as $in) { echo $in; } echo $gnrt->getReturn(); //13
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/OUnBG
function name:  (null)
number of ops:  12
compiled vars:  !0 = $gnrt, !1 = $in
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'rave'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   18     3      > FE_RESET_R                                       $4      !0, ->7
          4    > > FE_FETCH_R                                               $4, !1, ->7
   19     5    >   ECHO                                                     !1
   18     6      > JMP                                                      ->4
          7    >   FE_FREE                                                  $4
   21     8        INIT_METHOD_CALL                                         !0, 'getReturn'
          9        DO_FCALL                                      0  $5      
         10        ECHO                                                     $5
         11      > RETURN                                                   1

Function rave:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/OUnBG
function name:  rave
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        INIT_FCALL_BY_NAME                                       'one'
          2        DO_FCALL                                      0  $0      
          3        YIELD_FROM                                       ~1      $0
          4        FREE                                                     ~1
    5     5        INIT_FCALL_BY_NAME                                       'two'
          6        DO_FCALL                                      0  $2      
          7        YIELD_FROM                                       ~3      $2
          8      > GENERATOR_RETURN                                         
    6     9*     > GENERATOR_RETURN                                         

End of function rave

Function one:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/OUnBG
function name:  one
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   GENERATOR_CREATE                                         
    9     1        YIELD                                                    1
   10     2      > GENERATOR_RETURN                                         

End of function one

Function two:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/OUnBG
function name:  two
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   GENERATOR_CREATE                                         
   13     1        YIELD                                                    2
   14     2      > GENERATOR_RETURN                                         
   15     3*     > GENERATOR_RETURN                                         

End of function two

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.32 ms | 1003 KiB | 14 Q