3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen($first, $last) { for($i = $first; $i < $last + 1; ++$i) { yield $i; } } echo '5 -> 10:' . PHP_EOL; foreach (gen(5, 10) as $val) { echo $val . PHP_EOL; } $g = gen(1, 5); xdebug_debug_zval('g');
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/bgJPu
function name:  (null)
number of ops:  20
compiled vars:  !0 = $val, !1 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     '5+-%3E+10%3A%0A'
    9     1        INIT_FCALL                                               'gen'
          2        SEND_VAL                                                 5
          3        SEND_VAL                                                 10
          4        DO_FCALL                                      0  $2      
          5      > FE_RESET_R                                       $3      $2, ->10
          6    > > FE_FETCH_R                                               $3, !0, ->10
   10     7    >   CONCAT                                           ~4      !0, '%0A'
          8        ECHO                                                     ~4
    9     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $3
   12    11        INIT_FCALL                                               'gen'
         12        SEND_VAL                                                 1
         13        SEND_VAL                                                 5
         14        DO_FCALL                                      0  $5      
         15        ASSIGN                                                   !1, $5
   13    16        INIT_FCALL_BY_NAME                                       'xdebug_debug_zval'
         17        SEND_VAL_EX                                              'g'
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 5
Branch analysis from position: 10
Branch analysis from position: 5
filename:       /in/bgJPu
function name:  gen
number of ops:  11
compiled vars:  !0 = $first, !1 = $last, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
    4     3        ASSIGN                                                   !2, !0
          4      > JMP                                                      ->7
    5     5    >   YIELD                                                    !2
    4     6        PRE_INC                                                  !2
          7    >   ADD                                              ~6      !1, 1
          8        IS_SMALLER                                               !2, ~6
          9      > JMPNZ                                                    ~7, ->5
    7    10    > > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.4 ms | 1399 KiB | 15 Q