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

Reply

Join Date: Sep 2004
Posts: 25
Reputation: billah_norm is an unknown quantity at this point 
Solved Threads: 0
billah_norm billah_norm is offline Offline
Light Poster

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

 
0
  #1
Oct 22nd, 2004
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?
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 282
Reputation: Roberdin will become famous soon enough Roberdin will become famous soon enough 
Solved Threads: 6
Team Colleague
Roberdin Roberdin is offline Offline
Supreme Evil Overlord

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

 
0
  #2
Oct 25th, 2004
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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 1
Reputation: MENAMENA is an unknown quantity at this point 
Solved Threads: 0
MENAMENA MENAMENA is offline Offline
Newbie Poster

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

 
0
  #3
Mar 1st, 2008
can you help me build a c++break code and flowchart?

tnx..Rachelle
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 84
Reputation: johnsquibb is an unknown quantity at this point 
Solved Threads: 14
johnsquibb's Avatar
johnsquibb johnsquibb is offline Offline
Junior Poster in Training

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

 
0
  #4
Mar 1st, 2008
Originally Posted by billah_norm View Post
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:

  1. <?php
  2.  
  3. for($i=0; $i < 50; $i++)
  4. {
  5. //skip numbers 4
  6. if($i == 4)
  7. {
  8. continue;
  9. }
  10.  
  11. //exit early
  12. if($i == 25)
  13. {
  14. break;
  15. }
  16.  
  17. //print each result
  18. echo $i;
  19.  
  20. }
  21.  
  22. ?>
Last edited by johnsquibb; Mar 1st, 2008 at 10:27 am. Reason: fixed a comment
The End
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC