3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($current_day, $delay) { return ((((min($current_day, 5))+($delay-1))%5)+1); } for($i = 1; $i < 8; $i++) printf("f(%d, 1) => %d\n", $i, f($i, 1)); for($i = 1; $i < 8; $i++) printf("f(%d, 2) => %d\n", $i, f($i, 2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 16
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 16
Branch analysis from position: 28
Branch analysis from position: 16
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 2
Branch analysis from position: 14
Branch analysis from position: 2
filename:       /in/WJZu4
function name:  (null)
number of ops:  29
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->12
    9     2    >   INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 'f%28%25d%2C+1%29+%3D%3E+%25d%0A'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'f'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 1
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                                 
    8    11        PRE_INC                                                  !0
         12    >   IS_SMALLER                                               !0, 8
         13      > JMPNZ                                                    ~5, ->2
   11    14    >   ASSIGN                                                   !0, 1
         15      > JMP                                                      ->26
   12    16    >   INIT_FCALL                                               'printf'
         17        SEND_VAL                                                 'f%28%25d%2C+2%29+%3D%3E+%25d%0A'
         18        SEND_VAR                                                 !0
         19        INIT_FCALL                                               'f'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 2
         22        DO_FCALL                                      0  $7      
         23        SEND_VAR                                                 $7
         24        DO_ICALL                                                 
   11    25        PRE_INC                                                  !0
         26    >   IS_SMALLER                                               !0, 8
         27      > JMPNZ                                                    ~10, ->16
   12    28    > > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WJZu4
function name:  f
number of ops:  12
compiled vars:  !0 = $current_day, !1 = $delay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        INIT_FCALL                                               'min'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 5
          5        DO_ICALL                                         $2      
          6        SUB                                              ~3      !1, 1
          7        ADD                                              ~4      $2, ~3
          8        MOD                                              ~5      ~4, 5
          9        ADD                                              ~6      ~5, 1
         10      > RETURN                                                   ~6
    6    11*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.63 ms | 1403 KiB | 19 Q