3v4l.org

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

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

End of function xrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.83 ms | 1403 KiB | 14 Q