3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } $generator = xrange(1, 100); var_dump($generator); while ($generator->valid()) { print $generator->current() . PHP_EOL; $generator->next(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/5uF7I
function name:  (null)
number of ops:  19
compiled vars:  !0 = $generator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'xrange'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 100
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   11     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   13     8      > JMP                                                      ->15
   14     9    >   INIT_METHOD_CALL                                         !0, 'current'
         10        DO_FCALL                                      0  $4      
         11        CONCAT                                           ~5      $4, '%0A'
         12        ECHO                                                     ~5
   16    13        INIT_METHOD_CALL                                         !0, 'next'
         14        DO_FCALL                                      0          
   13    15    >   INIT_METHOD_CALL                                         !0, 'valid'
         16        DO_FCALL                                      0  $7      
         17      > JMPNZ                                                    $7, ->9
   17    18    > > RETURN                                                   1

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

End of function xrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.96 ms | 1440 KiB | 15 Q