fork download
  1. <?php
  2. function totalPay($creditSum, $monthPay, $monthPercent, $tax){
  3. for ($i = 0; $i <= 20; $i++){
  4. $totalPayBank = $creditSum * $monthPercent + $tax - $monthPay;
  5. $total = $total + $monthPay;
  6. }
  7. return $total;
  8. }
  9.  
  10. $creditSum = 39999;
  11. $monthPay = 5000;
  12. $homoCreditTotal = totalPay(39999, 5000, 1.04, 500);
  13. $softBankTotal = totalPay(39999, 5000, 1.03, 1000);
  14. $strawberryBank = totalPay(39999, 5000, 1.02, 7777);
  15.  
  16. echo "{$homoCreditTotal}\n";
  17. echo "{$softBankTotal}\n";
  18.  
Success #stdin #stdout #stderr 0.02s 24448KB
stdin
Standard input is empty
stdout

stderr
PHP Notice:  Undefined variable: total in /home/o3kB27/prog.php on line 8
PHP Notice:  Undefined variable: total in /home/o3kB27/prog.php on line 8
PHP Notice:  Undefined variable: total in /home/o3kB27/prog.php on line 8