AV1611 Posted June 13, 2006 Share Posted June 13, 2006 Hard to explain, let's say you have to loops, loop a and loop bcan you make a script that runs loop a ( a while loop for example), then later does loop b (another while loop)then if a certain clause at the end of loop b comes true, you can send it back to loop a...in basic, it would be GOTO... PHP doesn't have that ability, does it? Quote Link to comment https://forums.phpfreaks.com/topic/11880-calling-previous-loop/ Share on other sites More sharing options...
joquius Posted June 13, 2006 Share Posted June 13, 2006 aha yes goto and :function is replace withfunction foo () { } to define the function and foo(); to execute[code]$a = 3;function foo (){ while ($a > 1) { $a = $a - 1; echo "A is great"; }}function mu (){ while ($a < 1) { $a = $a + 1; echo "B is great"; }}if ($a > 1) foo(); else mu();if ($a == 1) echo "boring";[/code] Quote Link to comment https://forums.phpfreaks.com/topic/11880-calling-previous-loop/#findComment-45070 Share on other sites More sharing options...
AV1611 Posted June 13, 2006 Author Share Posted June 13, 2006 So, instead of going to the loop, you bring the loop to you...but no way to restart the entire script starting at that point...[!--quoteo(post=383317:date=Jun 13 2006, 11:24 AM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 13 2006, 11:24 AM) [snapback]383317[/snapback][/div][div class=\'quotemain\'][!--quotec--]aha yes goto and :function is replace withfunction foo () { } to define the function and foo(); to execute[code]$a = 3;function foo (){ while ($a > 1) { $a = $a - 1; echo "A is great"; }}function mu (){ while ($a < 1) { $a = $a + 1; echo "B is great"; }}if ($a > 1) foo(); else mu();if ($a == 1) echo "boring";[/code][/quote] Quote Link to comment https://forums.phpfreaks.com/topic/11880-calling-previous-loop/#findComment-45074 Share on other sites More sharing options...
joquius Posted June 13, 2006 Share Posted June 13, 2006 I've got a terrible migrane so ignore that junk, but what is it you need?why do u need the beginning? Quote Link to comment https://forums.phpfreaks.com/topic/11880-calling-previous-loop/#findComment-45076 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.