<?php
function getBalanceInFuture( $credit , $payment , $commission , $percent , $newAccount ) {
$credit = $credit + $newAccount ;
for ( $i = 0 ; $i <= 100 ; $i ++ ) {
$credit = ( $credit * $percent ) + $commission - $payment ;
$paymentTotal = $paymentTotal + $payment ;
$creditNext = ( $credit * $percent ) + $commission - $payment ;
if ( $creditNext <= 0 ) {
$paymentTotal = $paymentTotal + ( $credit * $percent ) + $commission ;
break ;
}
}
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 " ;
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CmZ1bmN0aW9uIGdldEJhbGFuY2VJbkZ1dHVyZSgkY3JlZGl0LCAkcGF5bWVudCwgJGNvbW1pc3Npb24sICRwZXJjZW50LCAkbmV3QWNjb3VudCApIHsKCSRjcmVkaXQgPSAkY3JlZGl0ICsgJG5ld0FjY291bnQ7Cglmb3IgKCAkaSA9IDA7ICRpPD0gMTAwOyAkaSsrKSB7CgkJJGNyZWRpdCA9ICgkY3JlZGl0ICogJHBlcmNlbnQpICsgJGNvbW1pc3Npb24gLSAkcGF5bWVudDsKCQkkcGF5bWVudFRvdGFsID0gJHBheW1lbnRUb3RhbCArICRwYXltZW50OwoJCSRjcmVkaXROZXh0ID0gKCRjcmVkaXQgKiAkcGVyY2VudCkgKyAkY29tbWlzc2lvbiAtICRwYXltZW50OwoJCWlmICggJGNyZWRpdE5leHQ8PTAgKSB7CgkJCSRwYXltZW50VG90YWw9JHBheW1lbnRUb3RhbCArICgkY3JlZGl0ICogJHBlcmNlbnQpICsgJGNvbW1pc3Npb247CgkJCWJyZWFrOwoJCX0KCX0KCXJldHVybiAkcGF5bWVudFRvd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