<?php

error_reporting(-1);

$mounth=0;
$realPrice=40000;

for ($credit=40000; $credit>0;$mounth++) {
	$realPrice=$realPrice+1000+(($credit/100)*3);
	$credit=$credit+1000+(($credit/100)*3);
	$credit=$credit-5000;
}

echo "Реальная цена айфона $realPrice\nКол-во месяцев $mounth";

?>