<?php
function getBalanceInFuture($credit, $payment, $commission, $percent, $newAccount ) {
$credit += $newAccount;
$paymentTotal = 0;
for ( $i = 0; $i<= 100; $i++) {
$credit = ($credit * $percent) + $commission;
if ($credit >5000) {
$credit -= $payment;
}else{
$paymentTotal += $credit;
break;
}
$paymentTotal += $payment;
}
return $paymentTotal;
}
$credit = 39999;
$payment = 5000;
$homoCredit = getBalanceInFuture($credit, $payment ,500 , 1.04, 0 );
$softBank = getBalanceInFuture($credit, $payment ,1000 , 1.03, 0 );
$strawberryBank = getBalanceInFuture($credit, $payment ,0 , 1.02, 7777 );
echo "$homoCredit\n";
echo "$softBank\n";
echo "$strawberryBank\n";
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBnZXRCYWxhbmNlSW5GdXR1cmUoJGNyZWRpdCwgJHBheW1lbnQsICRjb21taXNzaW9uLCAkcGVyY2VudCwgJG5ld0FjY291bnQgKSB7CgkkY3JlZGl0ICs9ICRuZXdBY2NvdW50OwoJJHBheW1lbnRUb3RhbCA9IDA7Cglmb3IgKCAkaSA9IDA7ICRpPD0gMTAwOyAkaSsrKSB7CgkJJGNyZWRpdCA9ICgkY3JlZGl0ICogJHBlcmNlbnQpICsgJGNvbW1pc3Npb247CgkJaWYgKCRjcmVkaXQgPjUwMDApCXsKCQkJJGNyZWRpdCAtPSAkcGF5bWVudDsKCQl9ZWxzZXsKCQkJJHBheW1lbnRUb3RhbCArPSAkY3JlZGl0OwoJCQlicmVhazsKCQl9CgkJJHBheW1lbnRUb3RhbCArPSAkcGF5bWVudDsKCX0KCXJldHVybiAkcGF5bWVudFRvdGFsOwp9CiRjcmVkaXQgPSAzOTk5OTsKJHBheW1lbnQgPSA1MDAwOwokaG9tb0NyZWRpdCA9IGdldEJhbGFuY2VJbkZ1dHVyZSgkY3JlZGl0LCAkcGF5bWVudCAsNTAwICwgMS4wNCwgMCAgKTsKJHNvZnRCYW5rID0gZ2V0QmFsYW5jZUluRnV0dXJlKCRjcmVkaXQsICRwYXltZW50ICwxMDAwICwgMS4wMywgMCAgKTsKJHN0cmF3YmVycnlCYW5rID0gZ2V0QmFsYW5jZUluRnV0dXJlKCRjcmVkaXQsICRwYXltZW50ICwwICwgMS4wMiwgNzc3NyAgKTsKCmVjaG8gIiRob21vQ3JlZGl0XG4iOwplY2hvICIkc29mdEJhbmtcbiI7CmVjaG8gIiRzdHJhd2JlcnJ5QmFua1xuIjs=