954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Any keyword to break or continue a LOOP like as in C "break","continue" keawords??

Is there anything or keawords in PHP from which I can break or continue from a LOOP in PHP??

in C
for(i=0;i<=100;i++){
statement1....;
statement2....;

if(condition1)
break;
else
continue;
statement3....;
statement4....;
statement5....;
}

I need something like this in PHP..
Can anybody Help me?

billah_norm
Light Poster
25 posts since Sep 2004
Reputation Points: 10
Solved Threads: 0
 

In a loop, the break and continue keyworks work as in C; however, for IF I am not certain. Best to try them out and see what works, or check www.php.net

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

can you help me build a c++break code and flowchart?

tnx..Rachelle

MENAMENA
Newbie Poster
1 post since Mar 2008
Reputation Points: 10
Solved Threads: 0
 

Is there anything or keawords in PHP from which I can break or continue from a LOOP in PHP??

in C for(i=0;i<=100;i++){ statement1....; statement2....; if(condition1) break; else continue; statement3....; statement4....; statement5....; }

I need something like this in PHP.. Can anybody Help me?

syntax is the same as c. for example:

<?php

for($i=0; $i < 50; $i++)
{
	//skip numbers 4
	if($i == 4)
	{
		continue;
	}
	
	//exit early
	if($i == 25)
	{
		break;
	}
	
	//print each result
	echo $i;
	
}

?>
johnsquibb
Junior Poster in Training
84 posts since Nov 2007
Reputation Points: 14
Solved Threads: 14
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You