<?php
function getSum ( $percent , $tax , $account , $creditSum , $payout ) {
$paymentTotal = 0 ;
$creditSum = $creditSum + $account ;
for ( $i ; $i < 100 ; $i ++ ) {
$creditBalance = $creditSum * $percent - $payout + $tax ;
//надо подумать над другим ограничением цикла
$paymentTotal += $payout ;
$creditSum = $creditBalance ;
if ( $creditBalance < 0 ) {
$paymentTotal += $creditBalance ;
break ;
}
}
return $paymentTotal ;
}
$creditSum = 39999 ;
$payout = 5000 ;
$homoCreditBank = getSum ( 1.04 , 500 , 0 , $creditSum , $payout ) ;
$softBank = getSum ( 1.03 , 1000 , 0 , $creditSum , $payout ) ;
$StrawberryBankTotal = getSum ( 1.02 , 0 , 7777 , $creditSum , $payout ) ;
echo "homoCreditBank {$homoCreditBank} руб \n " ;
echo "SoftBank {$softBank} руб \n " ;
echo "StrawberryBankTotal {$StrawberryBankTotal} руб \n " ;
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBnZXRTdW0gKCRwZXJjZW50LCAkdGF4LCAkYWNjb3VudCwgJGNyZWRpdFN1bSwgJHBheW91dCkgewoJJHBheW1lbnRUb3RhbCA9IDA7CgkkY3JlZGl0U3VtID0gJGNyZWRpdFN1bSArICRhY2NvdW50OwoJZm9yICgkaSA7ICRpIDwgMTAwIDskaSsrKSB7CgkJJGNyZWRpdEJhbGFuY2UgPSAkY3JlZGl0U3VtICogJHBlcmNlbnQgLSAkcGF5b3V0ICsgJHRheDsKCQkvL9C90LDQtNC+INC/0L7QtNGD0LzQsNGC0Ywg0L3QsNC0INC00YDRg9Cz0LjQvCDQvtCz0YDQsNC90LjRh9C10L3QuNC10Lwg0YbQuNC60LvQsAoJCSRwYXltZW50VG90YWwgKz0gICRwYXlvdXQ7CgkJJGNyZWRpdFN1bSA9ICRjcmVkaXRCYWxhbmNlOwoJCWlmICgkY3JlZGl0QmFsYW5jZSA8IDApIHsKCQkJJHBheW1lbnRUb3RhbCArPSAkY3JlZGl0QmFsYW5jZTsKCQk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