<?php
function summa($procent,$komi,$schet){
$deposit=5000.0;
$dolg=39999;
$pereplata=0.0+$schet;
$month=1;
$vsego=0;
for($dolg;$dolg>=0;$month++){
$vsego=$dolg*$procent+$komi;
if ($vsego < $deposit){
$dolg=$dolg*$procent+$komi;
$pereplata=$pereplata + $dolg;
break;
}
else{
$dolg=$dolg*$procent+$komi-$deposit;
$pereplata=$pereplata + $deposit;}
}
return $pereplata;
}
$homoCredit = summa(1.04,500,0);
$softCredit = summa(1.03,1000,0);
$yagodaCredit = summa(1.02,0,7000);
echo "\n $homoCredit\n";
echo " $softCredit\n";
echo " $yagodaCredit\n";
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKZnVuY3Rpb24gc3VtbWEoJHByb2NlbnQsJGtvbWksJHNjaGV0KXsKJGRlcG9zaXQ9NTAwMC4wOwokZG9sZz0zOTk5OTsKJHBlcmVwbGF0YT0wLjArJHNjaGV0OwokbW9udGg9MTsKJHZzZWdvPTA7CmZvcigkZG9sZzskZG9sZz49MDskbW9udGgrKyl7CgkkdnNlZ289JGRvbGcqJHByb2NlbnQrJGtvbWk7CglpZiAoJHZzZWdvIDwgJGRlcG9zaXQpewoJJGRvbGc9JGRvbGcqJHByb2NlbnQrJGtvbWk7CgkkcGVyZXBsYXRhPSRwZXJlcGxhdGEgKwkkZG9sZzsKCWJyZWFrOwkKCX0KCWVsc2V7CgkkZG9sZz0kZG9sZyokcHJvY2VudCska29taS0kZGVwb3NpdDsKCQoJJHBlcmVwbGF0YT0kcGVyZXBsYXRhICsJJGRlcG9zaXQ7fQoJCgkKfQpyZXR1cm4gJHBlcmVwbGF0YTsKfQoJJGhvbW9DcmVkaXQgPSBzdW1tYSgxLjA0LDUwMCwwKTsKCSRzb2Z0Q3JlZGl0ID0gc3VtbWEoMS4wMywxMDAwLDApOwoJJHlhZ29kYUNyZWRpdCA9IHN1bW1hKDEuMDIsMCw3MDAwKTsKCQoJZWNobyAiXG4gJGhvbW9DcmVkaXRcbiI7CgllY2hvICIgJHNvZnRDcmVkaXRcbiI7CgllY2hvICIgJHlhZ29kYUNyZWRpdFxuIjs=