Welcome to WebmasterWorld Guest from 54.157.222.62

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

breaking free of a loop

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

10+ Year Member



I have

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

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

}else{

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)

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



the while statement?

$i = 0;
while($i < $n)
{
$i++;
}

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...