3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generate_ints($n){ foreach ( range(0,$n-1) as $number) { yield $number; } } $g = new Generator(); $gen = generate_ints(3); echo ($gen instanceof Generator),"\n"; foreach ($gen as $g) { echo $gen->current(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/C2JYk
function name:  (null)
number of ops:  18
compiled vars:  !0 = $g, !1 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $2      'Generator'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    9     3        INIT_FCALL                                               'generate_ints'
          4        SEND_VAL                                                 3
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   10     7        INSTANCEOF                                       ~7      !1, 'Generator'
          8        ECHO                                                     ~7
          9        ECHO                                                     '%0A'
   11    10      > FE_RESET_R                                       $8      !1, ->16
         11    > > FE_FETCH_R                                               $8, !0, ->16
   12    12    >   INIT_METHOD_CALL                                         !1, 'current'
         13        DO_FCALL                                      0  $9      
         14        ECHO                                                     $9
   11    15      > JMP                                                      ->11
         16    >   FE_FREE                                                  $8
   13    17      > RETURN                                                   1

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

End of function generate_ints

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.47 ms | 1399 KiB | 16 Q