3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xs() { for ($i = 0; $i < 5; $i++) { yield $i; } } $a = xs(); foreach($a as $b) { echo $b.','; echo next($a).','; echo $b."\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/uIkHG
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'xs'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3      > FE_RESET_R                                       $4      !0, ->15
          4    > > FE_FETCH_R                                               $4, !1, ->15
   13     5    >   CONCAT                                           ~5      !1, '%2C'
          6        ECHO                                                     ~5
   14     7        INIT_FCALL                                               'next'
          8        SEND_REF                                                 !0
          9        DO_ICALL                                         $6      
         10        CONCAT                                           ~7      $6, '%2C'
         11        ECHO                                                     ~7
   15    12        CONCAT                                           ~8      !1, '%0A'
         13        ECHO                                                     ~8
   11    14      > JMP                                                      ->4
         15    >   FE_FREE                                                  $4
   16    16      > RETURN                                                   1

Function xs:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 3
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 3
Branch analysis from position: 7
Branch analysis from position: 3
filename:       /in/uIkHG
function name:  xs
number of ops:  8
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        ASSIGN                                                   !0, 0
          2      > JMP                                                      ->5
    5     3    >   YIELD                                                    !0
    4     4        PRE_INC                                                  !0
          5    >   IS_SMALLER                                               !0, 5
          6      > JMPNZ                                                    ~4, ->3
    7     7    > > GENERATOR_RETURN                                         

End of function xs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.41 ms | 1399 KiB | 16 Q