Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1

Thread: For loop help

  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    For loop help

    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?)
    PHP Code:
    for($price=180000$i*=1.11
    (What I have so far)
    PHP Code:
        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
    Last edited by WeeDLY; 10-25-2012 at 11:59 PM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •