3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g1() { yield 1; yield 2; } function g2($g1) { yield from $g1; echo "!\n"; yield 3; } $g1 = g1(); $g2 = g2($g1); while ($g2->valid()) { var_dump($g2->current()); $g2->next(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 8
Branch analysis from position: 18
Branch analysis from position: 8
filename:       /in/Hj7J0
function name:  (null)
number of ops:  19
compiled vars:  !0 = $g1, !1 = $g2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'g1'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   15     3        INIT_FCALL                                               'g2'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !1, $4
   17     7      > JMP                                                      ->15
   18     8    >   INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'current'
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        DO_ICALL                                                 
   19    13        INIT_METHOD_CALL                                         !1, 'next'
         14        DO_FCALL                                      0          
   17    15    >   INIT_METHOD_CALL                                         !1, 'valid'
         16        DO_FCALL                                      0  $9      
         17      > JMPNZ                                                    $9, ->8
   20    18    > > RETURN                                                   1

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

End of function g1

Function g2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/Hj7J0
function name:  g2
number of ops:  7
compiled vars:  !0 = $g1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    9     2        YIELD_FROM                                       ~1      !0
          3        FREE                                                     ~1
   10     4        ECHO                                                     '%21%0A'
   11     5        YIELD                                                    3
   12     6      > GENERATOR_RETURN                                         

End of function g2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.05 ms | 1399 KiB | 17 Q