<?php
function bankPayments ( $percent , $comission , $oncePayment ) {
$credit = 39999 ;
$payment = 5000 ;
$k = 0 ;
$credit += $oncePayment ;
for ( $i = 0 ; $credit != 0 ; $i ++ ) {
$credit += $credit * $percent + $comission ;
if ( $credit < $payment and $credit != 0 ) {
$lastPayment = $credit ;
// echo"Credit $credit \n";
$credit = $credit - $lastPayment ;
$summ = $payment * $k + $lastPayment ;
echo "Summary $summ \n " ;
// echo "Last Payment $lastPayment \n";
$k ++;
echo "You'll spent $k month before credit is become $credit \n \n \n " ;
break ;
}
$credit -= $payment ;
$k ++;
}
}
echo "Homocredit bank: \n " ;
bankPayments( 0.04 , 500 , 0 ) ;
echo "Sofbank: \n " ;
bankPayments( 0.03 , 1000 , 0 ) ;
echo "Strawberry bank: \n " ;
bankPayments( 0.02 , 0 , 7777 ) ;
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKZnVuY3Rpb24gYmFua1BheW1lbnRzICgkcGVyY2VudCwgJGNvbWlzc2lvbiwgJG9uY2VQYXltZW50KXsKCSRjcmVkaXQgPSAzOTk5OTsKCSRwYXltZW50ID0gNTAwMDsKCSRrID0gMDsKCSRjcmVkaXQrPSRvbmNlUGF5bWVudDsKCWZvciAoJGk9MDsgJGNyZWRpdCAhPSAwOyAkaSsrKXsKCQkkY3JlZGl0ICs9ICRjcmVkaXQqJHBlcmNlbnQgKyAkY29taXNzaW9uOwoJCWlmKCRjcmVkaXQ8JHBheW1lbnQgYW5kICRjcmVkaXQgIT0gMCl7CgkJCQoJCQkkbGFzdFBheW1lbnQgPSAkY3JlZGl0OwoJCQkKCQkJCgkJLy8JZWNobyJDcmVkaXQgJGNyZWRpdCBcbiI7CgkJCQoJCQkkY3JlZGl0ID0gJGNyZWRpdCAtICRsYXN0UGF5bWVudDsKCQkJCgkJCSRzdW1tID0gJHBheW1lbnQqJGsrJGxhc3RQYXltZW50OwoJCQkKCQkJZWNobyAiU3VtbWFyeSAkc3VtbSBcbiI7CgkJCQoJCS8vCW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