<?php
function Credit($credit, $pay, $percent, $tax, $payForBill) {
$total = 0;
$credit += $payForBill;
for ($month = 1; $month < 30; $month ++){
$credit = $credit * $percent + $tax;
if ($credit < $pay) {
$total += $credit;
break;
}
else {
$credit -= $pay;
$total += $pay;
}
}
return $total;
}
$creditSum = 39999;
$payout = 5000;
$homoCreditTotal = Credit($creditSum, $payout, 1.04, 500, 0);
$softbankTotal = Credit($creditSum, $payout, 1.03, 1000, 0);
$strawberryBankTotal = Credit($creditSum, $payout, 1.02, 0, 7777);
echo "homoCredit: {$homoCreditTotal}\n";
echo "softbank: {$softbankTotal}\n";
echo "strawberryBank: {$strawberryBankTotal}\n";
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7CgpmdW5jdGlvbiBDcmVkaXQoJGNyZWRpdCwgJHBheSwgJHBlcmNlbnQsICR0YXgsICRwYXlGb3JCaWxsKSB7CgkkdG90YWwgPSAwOwoJJGNyZWRpdCArPSAkcGF5Rm9yQmlsbDsKCWZvciAoJG1vbnRoID0gMTsgJG1vbnRoIDwgMzA7ICRtb250aCArKyl7CgkJCgkJJGNyZWRpdCA9ICRjcmVkaXQgKiAkcGVyY2VudCArICR0YXg7CgkJCgkJaWYgKCRjcmVkaXQgPCAkcGF5KSB7CgkJCSR0b3RhbCArPSAkY3JlZGl0OwoJCQlicmVhazsKCQl9CgkJZWxzZSB7CgkJCSRjcmVkaXQgLT0gJHBheTsKCQkJJHRvdGFsICs9ICRwYXk7CgkJfQoJfQoJcmV0dXJuICR0b3RhbDsKfQoKJGNyZWRpdFN1bSA9IDM5OTk5OwokcGF5b3V0ID0gNTAwMDsKJGhvbW9DcmVkaXRUb3RhbCA9IENyZWRpdCgkY3JlZGl0U3VtLCAkcGF5b3V0LCAxLjA0LCA1MDAsIDApOwokc29mdGJhbmtUb3RhbCA9IENyZWRpdCgkY3JlZGl0U3VtLCAkcGF5b3V0LCAxLjAzLCAxMDAwLCAwKTsKJHN0cmF3YmVycnlCYW5rVG90YWwgPSBDcmVkaXQoJGNyZWRpdFN1bSwgJHBheW91dCwgMS4wMiwgMCwgNzc3Nyk7CgplY2hvICJob21vQ3JlZGl0OiB7JGhvbW9DcmVkaXRUb3RhbH1cbiI7CmVjaG8gInNvZnRiYW5rOiB7JHNvZnRiYW5rVG90YWx9XG4iOwplY2hvICJzdHJhd2JlcnJ5QmFuazogeyRzdHJhd2JlcnJ5QmFua1RvdGFsfVxuIjs=