3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { if ($start < $limit) { if ($step <= 0) { throw new LogicException('Step must be +ve'); } for ($i = $start; $i <= $limit; $i += $step) { yield $i; if ($i == 7) { return false; } } } else { if ($step >= 0) { throw new LogicException('Step must be -ve'); } for ($i = $start; $i >= $limit; $i -= $step) { yield $i; } } } foreach (xrange(1, 11, 1) as $val) { echo "$val "; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/U2QFb
function name:  (null)
number of ops:  13
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   INIT_FCALL                                               'xrange'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 11
          3        SEND_VAL                                                 1
          4        DO_FCALL                                      0  $1      
          5      > FE_RESET_R                                       $2      $1, ->11
          6    > > FE_FETCH_R                                               $2, !0, ->11
   28     7    >   NOP                                                      
          8        FAST_CONCAT                                      ~3      !0, '+'
          9        ECHO                                                     ~3
   27    10      > JMP                                                      ->6
         11    >   FE_FREE                                                  $2
   29    12      > RETURN                                                   1

Function xrange:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 22
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 14
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 14
Branch analysis from position: 21
Branch analysis from position: 14
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 30
Branch analysis from position: 34
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 30
Branch analysis from position: 34
Branch analysis from position: 30
filename:       /in/U2QFb
function name:  xrange
number of ops:  35
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        IS_SMALLER                                               !0, !1
          5      > JMPZ                                                     ~4, ->22
    5     6    >   IS_SMALLER_OR_EQUAL                                      !2, 0
          7      > JMPZ                                                     ~5, ->12
    6     8    >   NEW                                              $6      'LogicException'
          9        SEND_VAL_EX                                              'Step+must+be+%2Bve'
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $6
    9    12    >   ASSIGN                                                   !3, !0
         13      > JMP                                                      ->19
   10    14    >   YIELD                                                    !3
   12    15        IS_EQUAL                                                 !3, 7
         16      > JMPZ                                                     ~10, ->18
   13    17    > > GENERATOR_RETURN                                         
    9    18    >   ASSIGN_OP                                     1          !3, !2
         19    >   IS_SMALLER_OR_EQUAL                                      !3, !1
         20      > JMPNZ                                                    ~12, ->14
         21    > > JMP                                                      ->34
   17    22    >   IS_SMALLER_OR_EQUAL                                      0, !2
         23      > JMPZ                                                     ~13, ->28
   18    24    >   NEW                                              $14     'LogicException'
         25        SEND_VAL_EX                                              'Step+must+be+-ve'
         26        DO_FCALL                                      0          
         27      > THROW                                         0          $14
   21    28    >   ASSIGN                                                   !3, !0
         29      > JMP                                                      ->32
   22    30    >   YIELD                                                    !3
   21    31        ASSIGN_OP                                     2          !3, !2
         32    >   IS_SMALLER_OR_EQUAL                                      !1, !3
         33      > JMPNZ                                                    ~19, ->30
   25    34    > > GENERATOR_RETURN                                         

End of function xrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.43 ms | 1407 KiB | 14 Q