3v4l.org

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

Function gen:
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/qttre
function name:  gen
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, 1
          2      > JMP                                                      ->5
          3    >   YIELD                                                    !0
          4        PRE_INC                                                  !0
          5    >   IS_SMALLER                                               !0, 10
          6      > JMPNZ                                                    ~4, ->3
    5     7    > > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.72 ms | 1399 KiB | 16 Q