3v4l.org

run code in 300+ PHP versions simultaneously
<?php $wig = false; function generate(&$wig) { foreach (array( "apples", "oranges", "pears") as $fruit) { if (!$wig) { $wig = true; yield $fruit; } else return 0; } } foreach (generate($wig) as $k) var_dump($k); ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/gFuo4
function name:  (null)
number of ops:  12
compiled vars:  !0 = $wig, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <false>
   16     1        INIT_FCALL                                               'generate'
          2        SEND_REF                                                 !0
          3        DO_FCALL                                      0  $3      
          4      > FE_RESET_R                                       $4      $3, ->10
          5    > > FE_FETCH_R                                               $4, !1, ->10
   17     6    >   INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   16     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $4
   18    11      > RETURN                                                   1

Function generate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
filename:       /in/gFuo4
function name:  generate
number of ops:  14
compiled vars:  !0 = $wig, !1 = $fruit
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    5     2      > FE_RESET_R                                       $2      <array>, ->12
          3    > > FE_FETCH_R                                               $2, !1, ->12
    6     4    >   BOOL_NOT                                         ~3      !0
          5      > JMPZ                                                     ~3, ->9
    7     6    >   ASSIGN                                                   !0, <true>
    9     7        YIELD                                                    !1
          8      > JMP                                                      ->11
   10     9    >   FE_FREE                                                  $2
         10      > GENERATOR_RETURN                                         
    5    11    > > JMP                                                      ->3
         12    >   FE_FREE                                                  $2
   14    13      > GENERATOR_RETURN                                         

End of function generate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.31 ms | 1399 KiB | 16 Q