3v4l.org

run code in 300+ PHP versions simultaneously
<?php function xrange($start, $limit, $step = 1) { $array = array(); for ($i = $start; $i <= $limit; $i += $step) { $array[] = $i; } return $array; } foreach (xrange(0, 100, 5) as $i) { print $i . PHP_EOL; } function xrange2($start, $limit, $step = 1) { for ($i = $start; $i <= $limit; $i += $step) { yield $i; } } foreach (xrange2(0, 100, 5) as $i) { print $i . PHP_EOL; }
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
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 21
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
Branch analysis from position: 10
filename:       /in/i6sat
function name:  (null)
number of ops:  23
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'xrange'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100
          3        SEND_VAL                                                 5
          4        DO_FCALL                                      0  $1      
          5      > FE_RESET_R                                       $2      $1, ->10
          6    > > FE_FETCH_R                                               $2, !0, ->10
   10     7    >   CONCAT                                           ~3      !0, '%0A'
          8        ECHO                                                     ~3
    9     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $2
   18    11        INIT_FCALL                                               'xrange2'
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 100
         14        SEND_VAL                                                 5
         15        DO_FCALL                                      0  $4      
         16      > FE_RESET_R                                       $5      $4, ->21
         17    > > FE_FETCH_R                                               $5, !0, ->21
   19    18    >   CONCAT                                           ~6      !0, '%0A'
         19        ECHO                                                     ~6
   18    20      > JMP                                                      ->17
         21    >   FE_FREE                                                  $5
   20    22      > RETURN                                                   1

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

End of function xrange

Function xrange2:
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/i6sat
function name:  xrange2
number of ops:  11
compiled vars:  !0 = $start, !1 = $limit, !2 = $step, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      1
          3        GENERATOR_CREATE                                         
   14     4        ASSIGN                                                   !3, !0
          5      > JMP                                                      ->8
   15     6    >   YIELD                                                    !3
   14     7        ASSIGN_OP                                     1          !3, !2
          8    >   IS_SMALLER_OR_EQUAL                                      !3, !1
          9      > JMPNZ                                                    ~7, ->6
   17    10    > > GENERATOR_RETURN                                         

End of function xrange2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.09 ms | 950 KiB | 16 Q