3v4l.org

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

Function g:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2tMCA
function name:  g
number of ops:  16
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        ADD                                              ~2      !0, !1
          3        IS_SMALLER                                               5, ~2
          4      > JMPZ                                                     ~3, ->14
    6     5    >   INIT_FCALL                                               'min'
          6        ADD                                              ~4      !0, !1
          7        SEND_VAL                                                 ~4
          8        SEND_VAL                                                 5
          9        DO_ICALL                                         $5      
         10        MOD                                              ~6      $5, 5
         11        ADD                                              ~7      ~6, 1
         12      > RETURN                                                   ~7
         13*       JMP                                                      ->15
    8    14    > > RETURN                                                   !1
    9    15*     > RETURN                                                   null

End of function g

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

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.52 ms | 1394 KiB | 19 Q