logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > PHP
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 07-05-2012, 06:24 PM   #1
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default basics!?!

I am currently going over my basics and trying to make it second nature (without much luck :s)

I cant work out an issue with the for loop

for($r = 1; $r <=20; $r++){
echo $r . "<br/>";
}

works fine but:

for($r = 1; $r <=20; $r*2){
echo $r . "<br/>";
}

does not. Why? I assumed as I was using a mathematical operator it would work just fine.
tony09uk is offline   Reply With Quote
Old 07-06-2012, 01:46 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,164
Default

if i recall correctly it needs to be

for($r = 1; $r <=20; $r*=2){
echo $r . "<br/>";
}
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 07-11-2012, 09:50 PM   #3
tony09uk
 
Join Date: Oct 2010
Posts: 340
Default

thanks. Soted it perfectly
tony09uk is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:41 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com