3v4l.org

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

Function generate_ints:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 12
Branch analysis from position: 18
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/YsePr
function name:  generate_ints
number of ops:  19
compiled vars:  !0 = $n, !1 = $range, !2 = $i, !3 = $max
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        SUB                                              ~4      !0, 1
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
    4     8        ASSIGN                                                   !2, 0
          9        COUNT                                            ~8      !1
         10        ASSIGN                                                   !3, ~8
         11      > JMP                                                      ->16
    5    12    >   YIELD                                            $10     !2
         13        ASSIGN                                                   !2, $10
    6    14      > GENERATOR_RETURN                                         
    4    15*       PRE_INC                                                  !2
         16    >   IS_SMALLER                                               !2, !3
         17      > JMPNZ                                                    ~13, ->12
    9    18    > > GENERATOR_RETURN                                         

End of function generate_ints

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.37 ms | 1402 KiB | 16 Q