3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { if ($start < $limit) { echo 'yep'; if ($step <= 0) { throw new LogicException('Step must be +ve'); } echo $step; for ($i = $start; $i <= $limit; $i += $step) { yield $i; echo 'iter' . $i; } } } echo 'Single digit odd numbers from range(): ' . PHP_EOL; foreach (range(1, 9, -5) as $number) { echo $number . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/ClfXt
function name:  (null)
number of ops:  13
compiled vars:  !0 = $number
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ECHO                                                     'Single+digit+odd+numbers+from+range%28%29%3A++%0A'
   19     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 9
          4        SEND_VAL                                                 -5
          5        DO_ICALL                                         $1      
          6      > FE_RESET_R                                       $2      $1, ->11
          7    > > FE_FETCH_R                                               $2, !0, ->11
   20     8    >   CONCAT                                           ~3      !0, '%0A'
          9        ECHO                                                     ~3
   19    10      > JMP                                                      ->7
         11    >   FE_FREE                                                  $2
   21    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 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 22, Position 2 = 16
Branch analysis from position: 22
Branch analysis from position: 16
Branch analysis from position: 22
filename:       /in/ClfXt
function name:  xrange
number of ops:  23
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    >   ECHO                                                     'yep'
    6     7        IS_SMALLER_OR_EQUAL                                      !2, 0
          8      > JMPZ                                                     ~5, ->13
    7     9    >   NEW                                              $6      'LogicException'
         10        SEND_VAL_EX                                              'Step+must+be+%2Bve'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $6
    9    13    >   ECHO                                                     !2
   10    14        ASSIGN                                                   !3, !0
         15      > JMP                                                      ->20
   11    16    >   YIELD                                                    !3
   12    17        CONCAT                                           ~10     'iter', !3
         18        ECHO                                                     ~10
   10    19        ASSIGN_OP                                     1          !3, !2
         20    >   IS_SMALLER_OR_EQUAL                                      !3, !1
         21      > JMPNZ                                                    ~12, ->16
   15    22    > > GENERATOR_RETURN                                         

End of function xrange

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.17 ms | 1400 KiB | 15 Q