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 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/MAFGF
function name:  (null)
number of ops:  18
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        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   13     9        ECHO                                                     'foreaching...%0A'
   15    10      > FE_RESET_R                                       $6      !0, ->16
         11    > > FE_FETCH_R                                               $6, !1, ->16
   16    12    >   ECHO                                                     'what'
   17    13        CONCAT                                           ~7      !1, '%0A'
         14        ECHO                                                     ~7
   15    15      > JMP                                                      ->11
         16    >   FE_FREE                                                  $6
   18    17      > 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/MAFGF
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:
144.42 ms | 1399 KiB | 16 Q