3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xs() { $i = 0; while (true) { yield $i++; } } $xs = xs(); $xs->send(42); 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/DuV5h
function name:  (null)
number of ops:  22
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_METHOD_CALL                                         !0, 'send'
          4        SEND_VAL_EX                                              42
          5        DO_FCALL                                      0          
   13     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'next'
          8        DO_FCALL                                      0  $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
   14    11        INIT_FCALL                                               'var_dump'
         12        INIT_METHOD_CALL                                         !0, 'valid'
         13        DO_FCALL                                      0  $6      
         14        SEND_VAR                                                 $6
         15        DO_ICALL                                                 
   15    16        INIT_FCALL                                               'var_dump'
         17        INIT_METHOD_CALL                                         !0, 'current'
         18        DO_FCALL                                      0  $8      
         19        SEND_VAR                                                 $8
         20        DO_ICALL                                                 
         21      > 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/DuV5h
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:
149.24 ms | 1399 KiB | 16 Q