suttercain Posted March 11, 2007 Share Posted March 11, 2007 Hi Everyone, I have been studying PHP for about 6 weeks and am self educating. The one thing I cannot grasp is the specific difference. Tell me if I have this right: for - This is a basic loop that once executed will go through until a certain expression is met. while - the same thing as the for loop but with just a different syntax do while - same as while but will execute at least once even if an expression is not met. foreach - used on arrays Is there anything I am missing, wrong on or can someone do a basic explanation. I have looked in book and on sites but just want a basic rundown. Thanks. Link to comment https://forums.phpfreaks.com/topic/42189-difference-between-loops/ Share on other sites More sharing options...
Psycho Posted March 11, 2007 Share Posted March 11, 2007 Pretty much, but a while loop is not the "same thing" as a for loop with different syntax. It is a much more complex construct. All you need to know about php can be found in the manual: for: http://us3.php.net/manual/en/control-structures.for.php while: http://us3.php.net/manual/en/control-structures.while.php do while: http://us3.php.net/manual/en/control-structures.do.while.php foreach: http://us3.php.net/manual/en/control-structures.foreach.php Link to comment https://forums.phpfreaks.com/topic/42189-difference-between-loops/#findComment-204663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.