3v4l.org

run code in 300+ PHP versions simultaneously
<?php function repeatInt(int $value, int $min, int $max) { $validValueNum = $max - $min + 1; $value = ($value + $min) % $validValueNum; return $value; } echo 'Test 2 to 5' . PHP_EOL; echo '---------------------------------' . PHP_EOL; foreach (range(-10, 10) as $i) { echo $i . ' → ' . repeatInt($i, 2, 5) . PHP_EOL; } echo PHP_EOL; echo 'Test 3 to 8' . PHP_EOL; echo '---------------------------------' . PHP_EOL; foreach (range(-10, 10) as $i) { echo $i . ' → ' . repeatInt($i, 3, 8) . PHP_EOL; } echo PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 38
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 38
Branch analysis from position: 18
filename:       /in/GHtMn
function name:  (null)
number of ops:  41
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'Test+2+to+5%0A'
   12     1        ECHO                                                     '---------------------------------%0A'
   13     2        INIT_FCALL                                               'range'
          3        SEND_VAL                                                 -10
          4        SEND_VAL                                                 10
          5        DO_ICALL                                         $1      
          6      > FE_RESET_R                                       $2      $1, ->18
          7    > > FE_FETCH_R                                               $2, !0, ->18
   15     8    >   CONCAT                                           ~3      !0, '+%E2%86%92+'
          9        INIT_FCALL                                               'repeatint'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 2
         12        SEND_VAL                                                 5
         13        DO_FCALL                                      0  $4      
         14        CONCAT                                           ~5      ~3, $4
         15        CONCAT                                           ~6      ~5, '%0A'
         16        ECHO                                                     ~6
   13    17      > JMP                                                      ->7
         18    >   FE_FREE                                                  $2
   17    19        ECHO                                                     '%0A'
   19    20        ECHO                                                     'Test+3+to+8%0A'
   20    21        ECHO                                                     '---------------------------------%0A'
   21    22        INIT_FCALL                                               'range'
         23        SEND_VAL                                                 -10
         24        SEND_VAL                                                 10
         25        DO_ICALL                                         $7      
         26      > FE_RESET_R                                       $8      $7, ->38
         27    > > FE_FETCH_R                                               $8, !0, ->38
   23    28    >   CONCAT                                           ~9      !0, '+%E2%86%92+'
         29        INIT_FCALL                                               'repeatint'
         30        SEND_VAR                                                 !0
         31        SEND_VAL                                                 3
         32        SEND_VAL                                                 8
         33        DO_FCALL                                      0  $10     
         34        CONCAT                                           ~11     ~9, $10
         35        CONCAT                                           ~12     ~11, '%0A'
         36        ECHO                                                     ~12
   21    37      > JMP                                                      ->27
         38    >   FE_FREE                                                  $8
   25    39        ECHO                                                     '%0A'
   26    40      > RETURN                                                   1

Function repeatint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GHtMn
function name:  repeatInt
number of ops:  11
compiled vars:  !0 = $value, !1 = $min, !2 = $max, !3 = $validValueNum
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    4     3        SUB                                              ~4      !2, !1
          4        ADD                                              ~5      ~4, 1
          5        ASSIGN                                                   !3, ~5
    6     6        ADD                                              ~7      !0, !1
          7        MOD                                              ~8      ~7, !3
          8        ASSIGN                                                   !0, ~8
    8     9      > RETURN                                                   !0
    9    10*     > RETURN                                                   null

End of function repeatint

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.31 ms | 1394 KiB | 17 Q