3v4l.org

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

Function gen1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/PellK
function name:  gen1
number of ops:  5
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                                         
    7     4*     > GENERATOR_RETURN                                         

End of function gen1

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

End of function gen2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.39 ms | 1394 KiB | 17 Q