fork download
  1. <?php
  2.  
  3.  
  4. function countTotalPayment ($creditDebt, $percent, $serviceFee, $monthlyPayment) {
  5. for ($months = 2, $paymentTotal = 0; $months <= 20; $months ++) {
  6. if ($months == 2) {
  7. $creditDebt = $creditDebt + 7777;
  8. }
  9. $creditDebt = ($creditDebt * $percent) + $serviceFee - $monthlyPayment;
  10. $paymentTotal = $paymentTotal + $monthlyPayment;
  11. if (($creditDebt * $percent) + $serviceFee < $monthlyPayment) {
  12. $paymentTotal = $paymentTotal + ($creditDebt * $percent) + $serviceFee;
  13. $months++;
  14. break;
  15. }
  16. }
  17. return $paymentTotal;
  18. }
  19.  
  20. $creditSum = 40000;
  21. $payout = 5000;
  22. $homoCreditTotal = countTotalPayment ($creditSum, 1.04, 500, $payout);
  23. $softbankTotal = countTotalPayment ($creditSum, 1.03, 1000, $payout);
  24. $strawberryBankTotal = countTotalPayment ($creditSum, 1.02, 0, $payout);
  25.  
  26. echo "HomoCredit: {$homoCreditTotal} \n";
  27. echo "Softbank: {$softbankTotal} \n";
  28. echo "StrawberryBank: {$strawberryBankTotal} \n";
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
HomoCredit: 70937.533493076 
Softbank: 76040.534327651 
StrawberryBank: 53561.117233508