fork(1) download
  1. <?php
  2. function eval_totalpayment($credit, $perc, $commission, $payment, $fee=0) {
  3. $credit+=$fee;
  4. for ($i = 1, $totalpayment = 0, $balance = $credit * (1 + $perc) + $commission; $balance > $payment; ++$i) {
  5. $balance -= $payment;
  6. $balance += $balance * $perc + $commission;
  7. $totalpayment += $payment;
  8. }
  9. $totalpayment += $balance;
  10. echo "Budet oplacheno $totalpayment za $i mecyacev\n";
  11. return $totalpayment;
  12. }
  13. $test = eval_totalpayment(40000, 0.03, 1000, 5000);
Success #stdin #stdout 0.02s 52472KB
stdin
Standard input is empty
stdout
Budet oplacheno 61270.186744521 za 13 mecyacev