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 $i->current(); echo "foreaching...\n"; foreach($i as $x) { echo "what"; echo $x . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/vmuCm
function name:  (null)
number of ops:  15
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
   11     3        INIT_METHOD_CALL                                         !0, 'current'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   13     6        ECHO                                                     'foreaching...%0A'
   15     7      > FE_RESET_R                                       $5      !0, ->13
          8    > > FE_FETCH_R                                               $5, !1, ->13
   16     9    >   ECHO                                                     'what'
   17    10        CONCAT                                           ~6      !1, '%0A'
         11        ECHO                                                     ~6
   15    12      > JMP                                                      ->8
         13    >   FE_FREE                                                  $5
   18    14      > 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/vmuCm
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:
145.8 ms | 1399 KiB | 14 Q