Try continue instead of break.

Sent via BlackBerry from Cingular Wireless  

-----Original Message-----
From: David Krings <[EMAIL PROTECTED]>
Date: Fri, 04 May 2007 21:01:29 
To:NYPHP Talk <[email protected]>
Subject: [nyphp-talk] Conditional break?

Hi!

Try to make this short. I have an array with path/file names. I want to 
move each file unless it already exists at its destination. What I want 
to do is end the current go through the while loop, increase a counter 
that I use for the while condition, and then start at the top of the 
while loop again. I tried using break as such

while ($counter < $max) {
        $error = move_file();
        if (!$error) {
                echo "Failed!"
                $counter++;
                break;
        } else {
                do_some_stuff();
        }
        $counter++;
}

The problem is that the whole thing stops as soon as it hits break, but 
I just want it to stop what it is doing now, increase $counter, and go 
back to the top and loop again. Obviously, break isn't the right thing 
to use. But what is?

Hope this is a more intelligent question than the others I asked in the 
past days. Sorry for that.

David
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk

NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com

Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php

Reply via email to