...

View Full Version : For loop help



WeeDLY
10-25-2012, 11:44 PM
Hey,

So my goal is to make for loop from 1992-2012 and have the price increase with 11% each year. the starting price is 180000$.

Below is what I have managed so far, but I don't know how I am supposed to solve it. Or is it possible to make 2 for loops. One which have years and one which is the price, something like this?
In advance thanks for the help.

(Possible to use this?)


for($price=180000; $i*=1.11)


(What I have so far)


for($i=1992; $i<=2012; $i++){

$price=180000;
$rent=1.11;

$price=$price*$rent;
echo $i.": ";
echo $price."<br />";
}


Edit: I just putted $price outside the loop and it worked, haha facepalming myself atm. Admin/mod can close this thread



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum