user11789406
user11789406

Reputation:

How to get out of 2 while loops and continue for loop process

Hello i was wondering on how can i get out of while loop while continuing the for loop, basically there is a while inside a while that's inside of a for loop.

<?php
for($i=1; $i <= counter($counter);$i++){
    while(){
        while(){
            if(){
               while(){
                  //if condition was met and successfully processed i want to go back to for loop. 
               }
            }else{
            }
        }
    }
}
?>

Upvotes: 0

Views: 60

Answers (1)

Gabriel
Gabriel

Reputation: 970

Use BREAK. You can also use BREAK 1 or 2 or 3 depends on how your loop nesting.

<?php
for($i=1; $i <= counter($counter);$i++){
    while(){
        while(){
            if(){
               while(){
                  //if condition was met and successfully processed i want to go back to for loop. 
                   break 3;
               }
            }else{
            }
        }
    }
}
?>

Upvotes: 1

Related Questions