<?php
function getCreditPayment($current, $percent, $service) {
$payed = 0;
$monthlyPayment = 5000;
for ($i = 0; $current > 0; $i++) {
$current = $current*$percent + $service - $monthlyPayment;
$payed += $monthlyPayment;
if ($current < 0) {
$payed += $current;
}
}
}
$totalHomoCredit = getCreditPayment(39999, 1.04, 500);
$totalSoftbank = getCreditPayment(39999, 1.03, 1000);
$totalStrawberryBank = getCreditPayment(39999+7777, 1.02, 0);
echo "HomoCredit: {$totalHomoCredit}\n";
echo "Softbank : {$totalSoftbank}\n";
echo "StrawberryBank: {$totalStrawberryBank}";
?>
PD9waHAgCgllcnJvcl9yZXBvcnRpbmcoLTEpOwoKCWZ1bmN0aW9uIGdldENyZWRpdFBheW1lbnQoJGN1cnJlbnQsICRwZXJjZW50LCAkc2VydmljZSkgewoJCSRwYXllZCA9IDA7CgkJJG1vbnRobHlQYXltZW50ID0gNTAwMDsKCQlmb3IgKCRpID0gMDsgJGN1cnJlbnQgPiAwOyAkaSsrKSB7CgkJCSRjdXJyZW50ID0gJGN1cnJlbnQqJHBlcmNlbnQgKyAkc2VydmljZSAtICRtb250aGx5UGF5bWVudDsKCQkJJHBheWVkICs9ICRtb250aGx5UGF5bWVudDsKCQkJaWYgKCRjdXJyZW50IDwgMCkgewoJCQkJJHBheWVkICs9ICRjdXJyZW50OwoJCQl9CgkJfQoJCXJldHVybiBjZWlsKCRwYXllZCk7Cgl9CgoJJHRvdGFsSG9tb0NyZWRpdCA9IGdldENyZWRpdFBheW1lbnQoMzk5OTksIDEuMDQsIDUwMCk7CgkkdG90YWxTb2Z0YmFuayA9IGdldENyZWRpdFBheW1lbnQoMzk5OTksIDEuMDMsIDEwMDApOwoJJHRvdGFsU3RyYXdiZXJyeUJhbmsgPSBnZXRDcmVkaXRQYXltZW50KDM5OTk5Kzc3NzcsIDEuMDIsIDApOwoKCWVjaG8gIkhvbW9DcmVkaXQ6IHskdG90YWxIb21vQ3JlZGl0fVxuIjsKCWVjaG8gIlNvZnRiYW5rIDogeyR0b3RhbFNvZnRiYW5rfVxuIjsKCWVjaG8gIlN0cmF3YmVycnlCYW5rOiB7JHRvdGFsU3RyYXdiZXJyeUJhbmt9IjsKPz4=