3v4l.org

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

Function generate_ints:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 17
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 8
Branch analysis from position: 6
filename:       /in/Z1PZp
function name:  generate_ints
number of ops:  19
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        IS_SMALLER                                       ~2      99, !0
          3      > JMPZ_EX                                          ~2      ~2, ->6
          4    >   IS_SMALLER                                       ~3      !0, 101
          5        BOOL                                             ~2      ~3
          6    > > JMPZ                                                     ~2, ->8
          7    >   YIELD                                                    !1
    5     8    >   INIT_FCALL                                               'range'
          9        SEND_VAL                                                 0
         10        SUB                                              ~5      !0, 1
         11        SEND_VAL                                                 ~5
         12        DO_ICALL                                         $6      
         13      > FE_RESET_R                                       $7      $6, ->17
         14    > > FE_FETCH_R                                               $7, !1, ->17
    6    15    >   YIELD                                                    !1
    5    16      > JMP                                                      ->14
         17    >   FE_FREE                                                  $7
    9    18      > GENERATOR_RETURN                                         

End of function generate_ints

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.8 ms | 1394 KiB | 16 Q