Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP's version of Perls next; ?

Status
Not open for further replies.

youradds

Programmer
Joined
Jun 27, 2001
Messages
817
Location
GB
Does anyone know if there is such a feaure in a foreach loop? In Perl, I could use something like;

Code:
foreach (@array) {

   if ($_ eq "test")   { last; } # break from the loop if the entry == test
   elsif ($_ =~ /\d/)  { next; } # skip next's

}

In PHP, the only function I can see if 'break', which seems to do the same as 'last' in Perl. Is there such a thing as 'next' in PHP?

Cheers

Andy
 
Thanks, I'll give that a go now :)

Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top