3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = "2016/6"; $rate = "2.90"; $summer = 7; $winter = 1; $bonus = 100000; $bcount = 30; $rate = $rate / 100; $hoge = get1_3($date, $rate, $summer, $winter, $bonus, $bcount); echo $hoge; function get1_3($date, $rate, $summer, $winter, $bonus, $bcount) { // 【1-3-1-1-1】AQ11 「初回利率」(少数12桁) // = +ROUNDDOWN(★手数料率(年利) * AP10 / 12, 12) $b_first_rate = getFirstRate($date, $rate, $summer, $winter); ##OK #echo $b_first_rate . "\r\n"; #exit; // 【1-3-1-1-2】AP4 「月利」(少数12桁) // = ROUND(★手数料率(年利) / 12, 12) $b_month_rate = round($rate / 12, 12); ##OK #echo $b_month_rate . "\r\n"; #exit; // 【1-3-1-1-4】AV18  // = +IF(ボーナス月1 = 8, VLOOKUP(★開始月, "1~12", 2, 0), VLOOKUP(★開始月, "5 or 7", 3, 0)) $t_date = explode("/", $date); $month = $t_date[1]; if(8 == $summer) { $a_bonusMonthArray = array( 1 => 7, 2 => 7, 3 => 7, 4 => 7, 5 => 7, 6 => 7, 7 => 7, 8 => 5, 9 => 5, 10 => 5, 11 => 5, 12 => 5); } else { $a_bonusMonthArray = array( 1 => 5, 2 => 7, 3 => 7, 4 => 7, 5 => 7, 6 => 7, 7 => 7, 8 => 7, 9 => 5, 10 => 5, 11 => 5, 12 => 5); } $keyNumber1 = $a_bonusMonthArray[$month]; ##OK #echo $keyNumber1 . "\r\n"; // ??? // 【1-3-1-1-3】AW18  // = +IF(【1-3-1-1-4】 = 5, 7, 5) if(5 == $keyNumber1) { $keyNumber2 = 7; } else { $keyNumber2 = 5; } #OK #echo $keyNumber2 . "\r\n"; #exit; //【1-3-1-1】AP22 「賦金率分子」 // = (1 + 【1-3-1-1-1】) * (1 + 【1-3-1-1-2】 * 【1-3-1-1-3】)^((【1-0-1】-1) / 2) * (1 + 【1-3-1-1-2】 * 【1-3-1-1-4】)^((【1-0-1】- 1) / 2) * ((1 + 【1-3-1-1-2】 * 【1-3-1-1-3】) * (1 + 【1-3-1-1-2】 * 【1-3-1-1-4】) - 1) $b_inst_numerator = (1 + $b_first_rate) * pow((1 + $b_month_rate * $keyNumber2),(($bcount - 1) / 2)) * pow((1 + $b_month_rate * $keyNumber1),(($bcount- 1) / 2)) * ((1 + $b_month_rate * $keyNumber2) * (1 + $b_month_rate * $keyNumber1) - 1); //【1-3-1-2】AP23 賦金率分母」 // = (1 + (1 + 【1-3-1-1-2】*【1-3-1-1-4】)) * ((1 +【1-3-1-1-2】*【1-3-1-1-3】)^((【1-0-1】-1)/2) * (1 +【1-3-1-1-2】*【1-3-1-1-4】)^((【1-0-1】- 1) / 2) - 1) + (1 +【1-3-1-1-2】*【1-3-1-1-3】)^((【1-0-1】- 1) / 2) * (1 +【1-3-1-1-2】*【1-3-1-1-4】) ^ ((【1-0-1】- 1) / 2) * ((1 +【1-3-1-1-2】*【1-3-1-1-3】) * (1 + 【1-3-1-1-2】*【1-3-1-1-4】) - 1) $b_inst_denominator = (1 + (1 + $b_month_rate * $keyNumber1)) * ( pow((1 + $b_month_rate * $keyNumber2),(($bcount - 1) / 2)) * pow((1 + $b_month_rate * $keyNumber1),(($bcount - 1) / 2)) - 1 ) + pow((1 + $b_month_rate * $keyNumber2),(($bcount - 1) / 2)) * pow((1 + $b_month_rate * $keyNumber1),(($bcount - 1) / 2)) * ((1 + $b_month_rate * $keyNumber2) * (1 + $b_month_rate * $keyNumber1) - 1); ##OK #echo $b_inst_numerator . "\r\n"; #echo (1 + (1 + $b_month_rate * $keyNumber1)) ; #exit; echo $b_inst_denominator . "\r\n"; exit; //【1-3-1】BE24 // = +ROUNDDOWN(【1-3-1-1】 / 【1-3-1-2】, 12) $b_result = round($b_inst_numerator / $b_inst_denominator, 12, PHP_ROUND_HALF_DOWN); //【1-3】BE25 ③ボーナス不均・奇数 // = +ROUNDUP(★ボーナス加算希望額 / 【1-3-1】,0) return round($bonus / $b_result, 0, PHP_ROUND_HALF_UP); } function getFirstRate($date, $rate, $summer, $winter) { //【1-2-1-2】AP11 「初回利率」(少数5桁) // = +ROUNDDOWN(★手数料率(年利) * 【1-2-1-2-1】 / 12, 5) // 【1-2-1-2-1】AP10 「初回期間」※支払開始後、最初のボーナス月までのヶ月 $t_date = explode("/", $date); $month = $t_date[1]; $monthCount = 0; while($monthCount < 12) { $monthCount++; $check = $month + $monthCount; if($check > 12) { $check = $check - 12; } if($check == $summer || $check == $winter) { $monthCount++; break; } } return round($rate * $monthCount / 12, 12, PHP_ROUND_HALF_DOWN); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8Rquf
function name:  (null)
number of ops:  19
compiled vars:  !0 = $date, !1 = $rate, !2 = $summer, !3 = $winter, !4 = $bonus, !5 = $bcount, !6 = $hoge
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '2016%2F6'
    4     1        ASSIGN                                                   !1, '2.90'
    5     2        ASSIGN                                                   !2, 7
    6     3        ASSIGN                                                   !3, 1
    7     4        ASSIGN                                                   !4, 100000
    8     5        ASSIGN                                                   !5, 30
   10     6        DIV                                              ~13     !1, 100
          7        ASSIGN                                                   !1, ~13
   12     8        INIT_FCALL_BY_NAME                                       'get1_3'
          9        SEND_VAR_EX                                              !0
         10        SEND_VAR_EX                                              !1
         11        SEND_VAR_EX                                              !2
         12        SEND_VAR_EX                                              !3
         13        SEND_VAR_EX                                              !4
         14        SEND_VAR_EX                                              !5
         15        DO_FCALL                                      0  $15     
         16        ASSIGN                                                   !6, $15
   13    17        ECHO                                                     !6
  122    18      > RETURN                                                   1

Function get1_3:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 37
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
filename:       /in/8Rquf
function name:  get1_3
number of ops:  131
compiled vars:  !0 = $date, !1 = $rate, !2 = $summer, !3 = $winter, !4 = $bonus, !5 = $bcount, !6 = $b_first_rate, !7 = $b_month_rate, !8 = $t_date, !9 = $month, !10 = $a_bonusMonthArray, !11 = $keyNumber1, !12 = $keyNumber2, !13 = $b_inst_numerator, !14 = $b_inst_denominator, !15 = $b_result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
   22     6        INIT_FCALL_BY_NAME                                       'getFirstRate'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        SEND_VAR_EX                                              !2
         10        SEND_VAR_EX                                              !3
         11        DO_FCALL                                      0  $16     
         12        ASSIGN                                                   !6, $16
   30    13        INIT_FCALL                                               'round'
         14        DIV                                              ~18     !1, 12
         15        SEND_VAL                                                 ~18
         16        SEND_VAL                                                 12
         17        DO_ICALL                                         $19     
         18        ASSIGN                                                   !7, $19
   39    19        INIT_FCALL                                               'explode'
         20        SEND_VAL                                                 '%2F'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $21     
         23        ASSIGN                                                   !8, $21
   40    24        FETCH_DIM_R                                      ~23     !8, 1
         25        ASSIGN                                                   !9, ~23
   41    26        IS_EQUAL                                                 !2, 8
         27      > JMPZ                                                     ~25, ->30
   42    28    >   ASSIGN                                                   !10, <array>
         29      > JMP                                                      ->31
   44    30    >   ASSIGN                                                   !10, <array>
   46    31    >   FETCH_DIM_R                                      ~28     !10, !9
         32        ASSIGN                                                   !11, ~28
   55    33        IS_EQUAL                                                 !11, 5
         34      > JMPZ                                                     ~30, ->37
   56    35    >   ASSIGN                                                   !12, 7
         36      > JMP                                                      ->38
   58    37    >   ASSIGN                                                   !12, 5
   68    38    >   ADD                                              ~33     1, !6
         39        INIT_FCALL                                               'pow'
         40        MUL                                              ~34     !7, !12
         41        ADD                                              ~35     1, ~34
         42        SEND_VAL                                                 ~35
         43        SUB                                              ~36     !5, 1
         44        DIV                                              ~37     ~36, 2
         45        SEND_VAL                                                 ~37
         46        DO_ICALL                                         $38     
         47        MUL                                              ~39     $38, ~33
         48        INIT_FCALL                                               'pow'
         49        MUL                                              ~40     !7, !11
         50        ADD                                              ~41     1, ~40
         51        SEND_VAL                                                 ~41
         52        SUB                                              ~42     !5, 1
         53        DIV                                              ~43     ~42, 2
         54        SEND_VAL                                                 ~43
         55        DO_ICALL                                         $44     
         56        MUL                                              ~45     $44, ~39
         57        MUL                                              ~46     !7, !12
         58        ADD                                              ~47     1, ~46
         59        MUL                                              ~48     !7, !11
         60        ADD                                              ~49     1, ~48
         61        MUL                                              ~50     ~47, ~49
         62        SUB                                              ~51     ~50, 1
         63        MUL                                              ~52     ~45, ~51
         64        ASSIGN                                                   !13, ~52
   72    65        MUL                                              ~54     !7, !11
         66        ADD                                              ~55     1, ~54
         67        ADD                                              ~56     1, ~55
         68        INIT_FCALL                                               'pow'
         69        MUL                                              ~57     !7, !12
         70        ADD                                              ~58     1, ~57
         71        SEND_VAL                                                 ~58
         72        SUB                                              ~59     !5, 1
         73        DIV                                              ~60     ~59, 2
         74        SEND_VAL                                                 ~60
         75        DO_ICALL                                         $61     
         76        INIT_FCALL                                               'pow'
         77        MUL                                              ~62     !7, !11
         78        ADD                                              ~63     1, ~62
         79        SEND_VAL                                                 ~63
         80        SUB                                              ~64     !5, 1
         81        DIV                                              ~65     ~64, 2
         82        SEND_VAL                                                 ~65
         83        DO_ICALL                                         $66     
         84        MUL                                              ~67     $61, $66
         85        SUB                                              ~68     ~67, 1
         86        MUL                                              ~69     ~56, ~68
         87        INIT_FCALL                                               'pow'
         88        MUL                                              ~70     !7, !12
         89        ADD                                              ~71     1, ~70
         90        SEND_VAL                                                 ~71
         91        SUB                                              ~72     !5, 1
         92        DIV                                              ~73     ~72, 2
         93        SEND_VAL                                                 ~73
         94        DO_ICALL                                         $74     
         95        INIT_FCALL                                               'pow'
         96        MUL                                              ~75     !7, !11
         97        ADD                                              ~76     1, ~75
         98        SEND_VAL                                                 ~76
         99        SUB                                              ~77     !5, 1
        100        DIV                                              ~78     ~77, 2
        101        SEND_VAL                                                 ~78
        102        DO_ICALL                                         $79     
        103        MUL                                              ~80     $74, $79
        104        MUL                                              ~81     !7, !12
        105        ADD                                              ~82     1, ~81
        106        MUL                                              ~83     !7, !11
        107        ADD                                              ~84     1, ~83
        108        MUL                                              ~85     ~82, ~84
        109        SUB                                              ~86     ~85, 1
        110        MUL                                              ~87     ~80, ~86
        111        ADD                                              ~88     ~69, ~87
        112        ASSIGN                                                   !14, ~88
   81   113        CONCAT                                           ~90     !14, '%0D%0A'
        114        ECHO                                                     ~90
   82   115      > EXIT                                                     
   87   116*       INIT_FCALL                                               'round'
        117*       DIV                                              ~91     !13, !14
        118*       SEND_VAL                                                 ~91
        119*       SEND_VAL                                                 12
        120*       SEND_VAL                                                 2
        121*       DO_ICALL                                         $92     
        122*       ASSIGN                                                   !15, $92
   92   123*       INIT_FCALL                                               'round'
        124*       DIV                                              ~94     !4, !15
        125*       SEND_VAL                                                 ~94
        126*       SEND_VAL                                                 0
        127*       SEND_VAL                                                 1
        128*       DO_ICALL                                         $95     
        129*       RETURN                                                   $95
   93   130*     > RETURN                                                   null

End of function get1_3

Function getfirstrate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 47) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
Branch analysis from position: 27
Branch analysis from position: 24
Branch analysis from position: 20
filename:       /in/8Rquf
function name:  getFirstRate
number of ops:  38
compiled vars:  !0 = $date, !1 = $rate, !2 = $summer, !3 = $winter, !4 = $t_date, !5 = $month, !6 = $monthCount, !7 = $check
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   96     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
  101     4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2F'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $8      
          8        ASSIGN                                                   !4, $8
  102     9        FETCH_DIM_R                                      ~10     !4, 1
         10        ASSIGN                                                   !5, ~10
  104    11        ASSIGN                                                   !6, 0
  105    12      > JMP                                                      ->27
  107    13    >   PRE_INC                                                  !6
  108    14        ADD                                              ~14     !5, !6
         15        ASSIGN                                                   !7, ~14
  110    16        IS_SMALLER                                               12, !7
         17      > JMPZ                                                     ~16, ->20
  111    18    >   SUB                                              ~17     !7, 12
         19        ASSIGN                                                   !7, ~17
  113    20    >   IS_EQUAL                                         ~19     !7, !2
         21      > JMPNZ_EX                                         ~19     ~19, ->24
         22    >   IS_EQUAL                                         ~20     !7, !3
         23        BOOL                                             ~19     ~20
         24    > > JMPZ                                                     ~19, ->27
  114    25    >   PRE_INC                                                  !6
  115    26      > JMP                                                      ->29
  105    27    >   IS_SMALLER                                               !6, 12
         28      > JMPNZ                                                    ~22, ->13
  120    29    >   INIT_FCALL                                               'round'
         30        MUL                                              ~23     !1, !6
         31        DIV                                              ~24     ~23, 12
         32        SEND_VAL                                                 ~24
         33        SEND_VAL                                                 12
         34        SEND_VAL                                                 2
         35        DO_ICALL                                         $25     
         36      > RETURN                                                   $25
  122    37*     > RETURN                                                   null

End of function getfirstrate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.76 ms | 1412 KiB | 19 Q