Jump to content


Photo

Help with looping variables


  • Please log in to reply
1 reply to this topic

#1 budeboy

budeboy
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 02 March 2006 - 07:24 PM

im trying to write a script that echos information in variables using a loop I know the code below is wrong but its the best way i could describe the sort o thing im trying to do

$i = 1;
while($i < 20){
 echo "$week$i";
}

is the sort of thing im trying to do is there a way to do a loop that echos variable $week1 then $week2 and so on intill $i = 20.

#2 craygo

craygo
  • Staff Alumni
  • Advanced Member
  • 1,973 posts
  • LocationRhode Island

Posted 02 March 2006 - 08:16 PM

<?
$i = 1;
while($i < 20){
echo "$week$i<br />";
$i++;
}

Hope that helps

Ray




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users