<?php

error_reporting(-1);
function checkTotal($percent,$comission){
    $totalPrice=39999;
    $payed=0;
    $payment=5000;
    for ($i=0; $totalPrice>$payed; $i++){
        $totalPrice=$totalPrice*(1+$percent/100)+$comission;
	$payed+=$payment;
    }
    return $totalPrice;
}
$homoPrice=checkTotal(4,500);
$softPrice=checkTotal(3,1000);
$strawberryPrice=checkTotal(2,0)+7777;

if (($homoPrice<$softPrice) && ($homoPrice<$strawberryPrice)){
    $winBank="HomoCredit";
    $winPrice=$homoPrice;
}elseif (($softPrice<$homoPrice) && ($softPrice<$strawberryPrice)){
    $winBank="Softbank";
    $winPrice=$softPrice;
}else{
    $winBank="StrawberryBank";   
    $winPrice=$strawberryPrice;
}
echo ("Наиболее выгодным, очевидно, являяется предложение банка {$winBank}.\n");
echo ("По кредиту будет выплачено {$winPrice} руб., за ".ceil($winPrice/5000)." месяцев.");