fork download
  1. <?php
  2.  
  3.  
  4. function credit($percent, $servicePayment, $fee, $creditBalance, $month, $paymentTotal, $payOut){
  5. $creditBalance=40000+$fee;
  6. $payOut=5000;
  7. for ($month = 1; $month <= 20; $month ++) {
  8.  
  9. $creditBalance = ( $creditBalance * $percent ) + $servicePayment - $payOut;
  10. $paymentTotal = $paymentTotal + $payOut;
  11. if ($creditBalance < 0) {
  12. $paymentTotal = $paymentTotal - $creditBalance;
  13. break;
  14.  
  15. }
  16. }
  17.  
  18. return $paymentTotal;
  19.  
  20. }
  21.  
  22. $homoTotal = credit(1.04, 500);
  23. $softTotal = credit(1.03,1000);
  24. $strawTotal = credit(1.02,0,7777);
  25. echo "Homo Credit Bank: {$homoTotal}руб.\n";
  26. echo "Soft Bank: {$softTotal}руб.\n";
  27. echo "Strawberry Bank: {$strawTotal}руб.\n";
  28.  
Success #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
Homo Credit Bank: 63574.835846157руб.
Soft Bank: 68729.813255479руб.
Strawberry Bank: 56438.882766492руб.
stderr
PHP Warning:  Missing argument 3 for credit(), called in /home/5LpEvn/prog.php on line 23 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 4 for credit(), called in /home/5LpEvn/prog.php on line 23 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 5 for credit(), called in /home/5LpEvn/prog.php on line 23 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 6 for credit(), called in /home/5LpEvn/prog.php on line 23 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 7 for credit(), called in /home/5LpEvn/prog.php on line 23 and defined in /home/5LpEvn/prog.php on line 5
PHP Notice:  Undefined variable: fee in /home/5LpEvn/prog.php on line 6
PHP Notice:  Undefined variable: paymentTotal in /home/5LpEvn/prog.php on line 11
PHP Warning:  Missing argument 3 for credit(), called in /home/5LpEvn/prog.php on line 24 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 4 for credit(), called in /home/5LpEvn/prog.php on line 24 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 5 for credit(), called in /home/5LpEvn/prog.php on line 24 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 6 for credit(), called in /home/5LpEvn/prog.php on line 24 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 7 for credit(), called in /home/5LpEvn/prog.php on line 24 and defined in /home/5LpEvn/prog.php on line 5
PHP Notice:  Undefined variable: fee in /home/5LpEvn/prog.php on line 6
PHP Notice:  Undefined variable: paymentTotal in /home/5LpEvn/prog.php on line 11
PHP Warning:  Missing argument 4 for credit(), called in /home/5LpEvn/prog.php on line 25 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 5 for credit(), called in /home/5LpEvn/prog.php on line 25 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 6 for credit(), called in /home/5LpEvn/prog.php on line 25 and defined in /home/5LpEvn/prog.php on line 5
PHP Warning:  Missing argument 7 for credit(), called in /home/5LpEvn/prog.php on line 25 and defined in /home/5LpEvn/prog.php on line 5
PHP Notice:  Undefined variable: paymentTotal in /home/5LpEvn/prog.php on line 11