Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

breaking free of a loop

12:52 am on Mar 27, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 1, 2002
votes: 0

I have

for ($i=0; $i < $n; $i++){

$temp = $arr
stuff happens to the temp array
and the values in array change


keep it all the same
}//end if

}//end for

I want to be able to break free of the loop before "else" having changed the values of the array but then start the loop again with the new array (values)=> ie change $arr to the temp values and then begin the loop again. I have tried all sorts of while/for loops with break/exit commands but nothing seems to work without messing up the array values!

Please can someone help! :)

12:58 am on Mar 27, 2003 (gmt 0)

Moderator from GB 

WebmasterWorld Administrator brotherhood_of_lan is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Jan 30, 2002
votes: 1

the while statement?

$i = 0;
while($i < $n)

if you had it as a function you could have another while statement that calls the function while you want to do stuff to the temp array...