fork(1) download
  1. <?php
  2. homoCredit(40000);
  3. function homoCredit($cost) {
  4. $balance=0;
  5. $total=0;
  6. for ($i=1; $balance > 0; $i++) {
  7. $balance=$cost*1.04+500;
  8. if ($balance >= 5000) {
  9. $balance -= 5000;
  10. $total += $i*5000;
  11. }
  12. else {
  13. $total += $balance;
  14. $balance = 0;
  15. }
  16. }
  17. echo "$total";
  18. return $total;
  19. }
  20.  
  21. /*$cost=39999;
  22. $homoCreditTotal = homoCredit($cost);
  23. echo "homocredit - $homoCreditTotal"; */
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
Standard output is empty