3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xs() { $i = 0; while (true) { yield $i++; } } $xs = xs(); var_dump($xs->valid()); var_dump($xs->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJAJ3
function name:  (null)
number of ops:  14
compiled vars:  !0 = $xs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'xs'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   11     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'valid'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   12     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'current'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
         13      > 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 = 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/XJAJ3
function name:  xs
number of ops:  7
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, 0
    4     2      > JMP                                                      ->5
    5     3    >   POST_INC                                         ~2      !0
          4        YIELD                                                    ~2
    4     5    > > JMPNZ                                                    <true>, ->3
    7     6    > > GENERATOR_RETURN                                         

End of function xs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.33 ms | 1398 KiB | 16 Q