3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_ints($N){ foreach ( range(0, $N) as $number) { yield $number; } } $gen = generate_ints(3); echo $gen->next(); echo $gen->next(); echo $gen->next(); echo $gen->next();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iRC2Q
function name:  (null)
number of ops:  17
compiled vars:  !0 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'generate_ints'
          1        SEND_VAL                                                 3
          2        DO_FCALL                                      0  $1      
          3        ASSIGN                                                   !0, $1
    8     4        INIT_METHOD_CALL                                         !0, 'next'
          5        DO_FCALL                                      0  $3      
          6        ECHO                                                     $3
    9     7        INIT_METHOD_CALL                                         !0, 'next'
          8        DO_FCALL                                      0  $4      
          9        ECHO                                                     $4
   10    10        INIT_METHOD_CALL                                         !0, 'next'
         11        DO_FCALL                                      0  $5      
         12        ECHO                                                     $5
   11    13        INIT_METHOD_CALL                                         !0, 'next'
         14        DO_FCALL                                      0  $6      
         15        ECHO                                                     $6
         16      > RETURN                                                   1

Function generate_ints:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 10
filename:       /in/iRC2Q
function name:  generate_ints
number of ops:  12
compiled vars:  !0 = $N, !1 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    3     2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 0
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > FE_RESET_R                                       $3      $2, ->10
          7    > > FE_FETCH_R                                               $3, !1, ->10
    4     8    >   YIELD                                                    !1
    3     9      > JMP                                                      ->7
         10    >   FE_FREE                                                  $3
    6    11      > GENERATOR_RETURN                                         

End of function generate_ints

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.73 ms | 1403 KiB | 16 Q