944,103 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 15742
  • PHP RSS
Oct 22nd, 2004
0

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

Expand 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?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
billah_norm is offline Offline
25 posts
since Sep 2004
Oct 25th, 2004
0

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

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
Team Colleague
Reputation Points: 63
Solved Threads: 6
Supreme Evil Overlord
Roberdin is offline Offline
282 posts
since Feb 2003
Mar 1st, 2008
0

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

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

tnx..Rachelle
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MENAMENA is offline Offline
1 posts
since Mar 2008
Mar 1st, 2008
0

Re: 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?
syntax is the same as c. for example:

php Syntax (Toggle Plain Text)
  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
Reputation Points: 14
Solved Threads: 14
Junior Poster in Training
johnsquibb is offline Offline
84 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Covert Cvs To Mysql
Next Thread in PHP Forum Timeline: building graph with swf flash





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC