fork download
  1. <?php
  2.  
  3. function findBestCredit($percent, $commission, $setupFee) {
  4.  
  5. global $credit;
  6. global $payout;
  7. global $start;
  8.  
  9. $credit = $credit + $setupFee;
  10.  
  11. for ($month = 1; $month <= 20; $month++) {
  12. $credit = ( $credit * $percent ) + $commission - $payout;
  13. $start = $start + $payout;
  14. if ($credit < 0) {
  15. $finish = $start + $credit;
  16. $finish = round($finish, 2);
  17. break;
  18. }
  19. }
  20. return $finish;
  21. }
  22.  
  23. $credit = 39999;
  24. $payout = 5000;
  25. $start = 0;
  26.  
  27. $bankHomo = findBestCredit(1.04,500,0);
  28. $bankSoft = findBestCredit(1.03,1000,0);
  29. $bankStra = findBestCredit(1.02,0,7777);
  30.  
  31. echo "$bankHomo $bankSoft $bankStra";
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
56423.56 57316.27 65095.14