fork download
  1. <?php
  2.  
  3. function credit($commission, $percent, $creditSum, $payout){
  4. for ($i=0; $creditSum > 0; $i++) {
  5. $creditSum =($creditSum * $percent) + $commission;
  6. if($creditSum< $payout){
  7.  
  8.  
  9. $payout = $creditSum;
  10. $creditSum = $creditSum - $payout;
  11.  
  12. break;
  13.  
  14. }elseif($creditSum >= $payout ){
  15.  
  16. $creditSum = $creditSum -$payout;
  17.  
  18.  
  19. return;
  20.  
  21. }
  22.  
  23. }
  24.  
  25.  
  26. }
  27.  
  28. $balance = credit(500,0.04,39999,5000);
  29. echo "$balance";
  30.  
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
Standard output is empty