homepage Welcome to WebmasterWorld Guest from 54.211.34.105
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
breaking free of a loop
k8tie

10+ Year Member



 
Msg#: 651 posted 12:52 am on Mar 27, 2003 (gmt 0)

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! :)

 

brotherhood of LAN

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



 
Msg#: 651 posted 12:58 am on Mar 27, 2003 (gmt 0)

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

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved