3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* the difference in days between today and '$delay' number business days (M-F). yes. */ function g($current_day, $delay) { /* wraps around to the next day which is '$delay' number of business days from today lol, math */ if(($current_day+$delay) > 5) return (((min($current_day, 5)+($delay-1))%5)+1); else return $delay; } function f($current_day, $delay) { return (((min($current_day, 5)+($delay-1))%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/Vf51N
function name:  (null)
number of ops:  32
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->12
   27     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                                                 
   26    11        PRE_INC                                                  !0
         12    >   IS_SMALLER                                               !0, 8
         13      > JMPNZ                                                    ~5, ->2
   29    14    >   INIT_FCALL                                               'printf'
         15        SEND_VAL                                                 '%0A%0A%0A%0A'
         16        DO_ICALL                                                 
   31    17        ASSIGN                                                   !0, 1
         18      > JMP                                                      ->29
   32    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                                                 
   31    28        PRE_INC                                                  !0
         29    >   IS_SMALLER                                               !0, 8
         30      > JMPNZ                                                    ~11, ->19
   32    31    > > RETURN                                                   1

Function g:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vf51N
function name:  g
number of ops:  17
compiled vars:  !0 = $current_day, !1 = $delay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        ADD                                              ~2      !0, !1
          3        IS_SMALLER                                               5, ~2
          4      > JMPZ                                                     ~3, ->15
   16     5    >   INIT_FCALL                                               'min'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 5
          8        DO_ICALL                                         $4      
          9        SUB                                              ~5      !1, 1
         10        ADD                                              ~6      $4, ~5
         11        MOD                                              ~7      ~6, 5
         12        ADD                                              ~8      ~7, 1
         13      > RETURN                                                   ~8
         14*       JMP                                                      ->16
   18    15    > > RETURN                                                   !1
   19    16*     > 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/Vf51N
function name:  f
number of ops:  12
compiled vars:  !0 = $current_day, !1 = $delay
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     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
   24    11*     > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.49 ms | 1402 KiB | 19 Q