laquitajohnson Posted April 8, 2011 Share Posted April 8, 2011 so, long story short. I am an idiot, I am a student, I decided to take 5 classes and work full time. I need help with :confused:my PHP and while loops... the book is just confusing me anymore... spring break started today and my teacher isn't responding to my E-mail... also, it's the end of the semester, and I'm not doing too great and if I don't get at least a "D" (haha) in the class, I will loose my Financial Aid... will someone take pity on my soul and please help me. Quote Link to comment https://forums.phpfreaks.com/topic/233040-hhhhhhhheeeeeeeellllllpppppp/ Share on other sites More sharing options...
drisate Posted April 8, 2011 Share Posted April 8, 2011 explain what exacly you need to know on while loops ... it's vast ... theres so much ways in using it lol The basic would be while (condition) { code to be executed; } Ex: <?php $i=1; while($i<=5) // Loop 5 times { echo "The number is " . $i . "<br />"; $i++; // Will add +1 to the $i var } ?> Quote Link to comment https://forums.phpfreaks.com/topic/233040-hhhhhhhheeeeeeeellllllpppppp/#findComment-1198542 Share on other sites More sharing options...
ShoeLace1291 Posted April 8, 2011 Share Posted April 8, 2011 A while loop is basically just like an if statement. Only difference is that the while loop repeats itself until the condition it's given is not true. For example, a while loop that executes if the number 10 is greater than 5, it will keep repeating itself. That is known as an infinite loop. A while loop that executes if 5 is greater than 10, it will never execute. Get the idea? Quote Link to comment https://forums.phpfreaks.com/topic/233040-hhhhhhhheeeeeeeellllllpppppp/#findComment-1198575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.