fork(2) download
  1. <?php
  2.  
  3.  
  4. function getBalanceInFuture($credit, $payment, $commission, $percent, $newAccount ) {
  5. $credit += $newAccount;
  6. $paymentTotal = 0;
  7. for ( $i = 0; $i<= 100; $i++) {
  8. $credit = ($credit * $percent) + $commission;
  9. if ($credit >5000) {
  10. $credit -= $payment;
  11. }else{
  12. $paymentTotal += $credit;
  13. break;
  14. }
  15. $paymentTotal += $payment;
  16. }
  17. return $paymentTotal;
  18. }
  19. $credit = 39999;
  20. $payment = 5000;
  21. $homoCredit = getBalanceInFuture($credit, $payment ,500 , 1.04, 0 );
  22. $softBank = getBalanceInFuture($credit, $payment ,1000 , 1.03, 0 );
  23. $strawberryBank = getBalanceInFuture($credit, $payment ,0 , 1.02, 7777 );
  24.  
  25. echo "$homoCredit\n";
  26. echo "$softBank\n";
  27. echo "$strawberryBank\n";
Success #stdin #stdout 0.03s 52480KB
stdin
Standard input is empty
stdout
56423.563121625
61268.718210807
53559.8738592