HCProfessionals Posted April 3, 2011 Share Posted April 3, 2011 $i = 0; while($i < 10) { if ($i == 7) { //Do Function } else { $i++ Go back to beginning of loop } //More if statements here. } Link to comment https://forums.phpfreaks.com/topic/232582-go-back-to-beginning-of-loop/ Share on other sites More sharing options...
dcro2 Posted April 3, 2011 Share Posted April 3, 2011 You mean... continue? It'll skip the rest of the loop and begin the next iteration. $i = 0; while($i < 10) { if ($i == 7) { //Do Function } else { $i++ continue; //Go back to beginning of loop } //More if statements here. } Link to comment https://forums.phpfreaks.com/topic/232582-go-back-to-beginning-of-loop/#findComment-1196326 Share on other sites More sharing options...
HCProfessionals Posted April 3, 2011 Author Share Posted April 3, 2011 Cannot break/continue 1 level Link to comment https://forums.phpfreaks.com/topic/232582-go-back-to-beginning-of-loop/#findComment-1196327 Share on other sites More sharing options...
dcro2 Posted April 3, 2011 Share Posted April 3, 2011 Is that an error? Sorry, I did miss a semicolon at the end of $i++. Link to comment https://forums.phpfreaks.com/topic/232582-go-back-to-beginning-of-loop/#findComment-1196344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.