Itirating foreach loop inside ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
fd ski
Forum Newbie
Posts: 3
Joined: Tue Jul 08, 2003 10:42 am

Itirating foreach loop inside ?

Post by fd ski »

Rather simple code...

foreach ($a as $e){

if(...){
do something, and don't process the rest of this foreach segment, just iterate to next one
}

if(...){
do something, and don't process the rest of this foreach segment, just iterate to next one
}


}

I tried break but it gets out of the whole statement ( foreach )
Example is simplified, there are multiple ifs indiside of foreach and it would really simplify things if i could "break" out of current iteration and have next one start right away, for clarity as well as processing time reasons.

Any ideas ? Thank you very much.
ik
Forum Commoner
Posts: 34
Joined: Thu Jul 10, 2003 5:33 am
Location: Lancs Uni, UK
Contact:

Post by ik »

Hi,
Just as in C,

Code: Select all

continue
does exactly what you want
Post Reply