fork(1) 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. $payout = $creditSum;
  9. $creditSum = $creditSum - $payout;
  10.  
  11. break;
  12.  
  13. }elseif($creditSum >= $payout ){
  14.  
  15. $creditSum = $creditSum -$payout;
  16.  
  17.  
  18.  
  19.  
  20. }
  21.  
  22. }
  23.  
  24.  
  25. }
  26. return;
  27. $balance = credit(500,0.04,39999,5000);
  28. echo "{$balance}";
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Standard output is empty