3v4l.org

run code in 300+ PHP versions simultaneously
<?php function repeatInt(int $val, int $min, int $max) { $validValueNum = $max - $min + 1; $result = ($val %$validValueNum + $min) % $validValueNum; if ($result< 0) { $result= $validValueNum + $result; } return $min + $result; } // ?????? foreach (range(-10, 5) as $i) echo $i .'='. repeatInt($i, 2, 5) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/htUj9
function name:  (null)
number of ops:  18
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 -10
          2        SEND_VAL                                                 5
          3        DO_ICALL                                         $1      
          4      > FE_RESET_R                                       $2      $1, ->16
          5    > > FE_FETCH_R                                               $2, !0, ->16
          6    >   CONCAT                                           ~3      !0, '%3D'
          7        INIT_FCALL                                               'repeatint'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 2
         10        SEND_VAL                                                 5
         11        DO_FCALL                                      0  $4      
         12        CONCAT                                           ~5      ~3, $4
         13        CONCAT                                           ~6      ~5, '%0A'
         14        ECHO                                                     ~6
         15      > JMP                                                      ->5
         16    >   FE_FREE                                                  $2
   17    17      > RETURN                                                   1

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

End of function repeatint

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.48 ms | 1402 KiB | 16 Q