3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xs() { $i = 0; while (true) { yield $i++; } } $xs = xs(); var_dump($xs->next()); 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/L802o
function name:  (null)
number of ops:  19
compiled vars:  !0 = $xs
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'xs'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   12     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'next'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   13     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !0, 'valid'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                                 
   14    13        INIT_FCALL                                               'var_dump'
         14        INIT_METHOD_CALL                                         !0, 'current'
         15        DO_FCALL                                      0  $7      
         16        SEND_VAR                                                 $7
         17        DO_ICALL                                                 
         18      > 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/L802o
function name:  xs
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 xs

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.97 ms | 1390 KiB | 16 Q