3v4l.org

run code in 300+ PHP versions simultaneously
<?php function g1() { yield 1; yield 2; } function g2() { var_dump(yield "a"); $a = yield; var_dump($a); var_dump(yield "b"); $b = yield; var_dump($b); } $g1=g1(); $g2=g2(); foreach($g1 as $v) { var_dump($g2->send($v)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/FWZt5
function name:  (null)
number of ops:  17
compiled vars:  !0 = $g1, !1 = $g2, !2 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'g1'
          1        DO_FCALL                                      0  $3      
          2        ASSIGN                                                   !0, $3
   18     3        INIT_FCALL                                               'g2'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   20     6      > FE_RESET_R                                       $7      !0, ->15
          7    > > FE_FETCH_R                                               $7, !2, ->15
   21     8    >   INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !1, 'send'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        DO_ICALL                                                 
   20    14      > JMP                                                      ->7
         15    >   FE_FREE                                                  $7
   22    16      > RETURN                                                   1

Function g1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/FWZt5
function name:  g1
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                                    1
    4     2        YIELD                                                    2
    5     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/FWZt5
function name:  g2
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   GENERATOR_CREATE                                         
    8     1        INIT_FCALL                                               'var_dump'
          2        YIELD                                            $2      'a'
          3        SEND_VAR                                                 $2
          4        DO_ICALL                                                 
    9     5        YIELD                                            $4      
          6        ASSIGN                                                   !0, $4
   10     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   12    10        INIT_FCALL                                               'var_dump'
         11        YIELD                                            $7      'b'
         12        SEND_VAR                                                 $7
         13        DO_ICALL                                                 
   13    14        YIELD                                            $9      
         15        ASSIGN                                                   !1, $9
   14    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                                 
   15    19      > GENERATOR_RETURN                                         

End of function g2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.42 ms | 1394 KiB | 17 Q