<?php
function calculationPayment( $percent , $commission , $payOpeningAccount , $payout , $creditSum ) {
$amountPayment = 0 ;
$amountCredit = $creditSum + $payOpeningAccount ;
for ( $month = 0 ; $amountCredit != 0 ; $month ++ ) {
$amountCredit += $percent * $amountCredit + $commission ;
if ( $amountCredit < $payout ) {
$amountPayment += $amountCredit ;
$amountCredit -= $amountCredit ;
} else {
$amountPayment += $payout ;
$amountCredit -= $payout ;
}
}
'month' => $month ,
'amountPayment' => $amountPayment
) ;
return $return ;
}
$creditSum = 39999 ;
$payout = 5000 ;
$homoCreditTotal = calculationPayment( 0.04 , 500 , 0 , $payout , $creditSum ) ;
$softbankTotal = calculationPayment( 0.03 , 1000 , 0 , $payout , $creditSum ) ;
$strawberryBankTotal = calculationPayment( 0.02 , 0 , 7777 , $payout , $creditSum ) ;
echo "homoCredit Сумма выплат: {$homoCreditTotal['amountPayment']} Срок в месяцах: {$homoCreditTotal['month']} \n " ;
echo "softbank: {$softbankTotal['amountPayment']} Срок в месяцах: {$softbankTotal['month']} \n " ;
echo "strawberryBank: {$strawberryBankTotal['amountPayment']} Срок в месяцах: {$strawberryBankTotal['month']} \n " ;
?>
PD9waHAKCgllcnJvcl9yZXBvcnRpbmcoLTEpOwoJbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CgkKCWZ1bmN0aW9uIGNhbGN1bGF0aW9uUGF5bWVudCgkcGVyY2VudCwgJGNvbW1pc3Npb24sICRwYXlPcGVuaW5nQWNjb3VudCwgJHBheW91dCwgJGNyZWRpdFN1bSl7CgkJJGFtb3VudFBheW1lbnQgPSAwOwoJCSRhbW91bnRDcmVkaXQgPSAkY3JlZGl0U3VtICsgJHBheU9wZW5pbmdBY2NvdW50OwoJCWZvcigkbW9udGggPSAwOyAkYW1vdW50Q3JlZGl0ICE9IDA7ICRtb250aCsrKXsKCQkJJGFtb3VudENyZWRpdCArPSAkcGVyY2VudCokYW1vdW50Q3JlZGl0ICsgJGNvbW1pc3Npb247CgkJCWl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