3v4l.org

run code in 500+ PHP versions simultaneously
<?php function naturalIntegers() { $i = 0; while (true) { yield $i++; } } foreach(naturalIntegers() as $i) { if ($i > 10) { break; } print $i.PHP_EOL; } print "finished\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
Branch analysis from position: 10
filename:       /in/X3KJH
function name:  (null)
number of ops:  13
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                                   'naturalintegers'
          1        DO_FCALL                                          0  $1      
          2      > FE_RESET_R                                           $2      $1, ->10
          3    > > FE_FETCH_R                                                   $2, !0, ->10
   11     4    >   IS_SMALLER                                                   10, !0
          5      > JMPZ                                                         ~3, ->7
   12     6    > > JMP                                                          ->10
   14     7    >   CONCAT                                               ~4      !0, '%0A'
          8        ECHO                                                         ~4
   10     9      > JMP                                                          ->3
         10    >   FE_FREE                                                      $2
   17    11        ECHO                                                         'finished%0A'
         12      > RETURN                                                       1

Function naturalintegers:
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 = 6, Position 2 = 3
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 6, Position 2 = 3
Branch analysis from position: 6
Branch analysis from position: 3
filename:       /in/X3KJH
function name:  naturalIntegers
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                             
    4     1        ASSIGN                                                       !0, 0
    5     2      > JMP                                                          ->5
    6     3    >   POST_INC                                             ~2      !0
          4        YIELD                                                        ~2
    5     5    > > JMPNZ                                                        <true>, ->3
    8     6    > > GENERATOR_RETURN                                             

End of function naturalintegers

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.44 ms | 1474 KiB | 14 Q