waz Posted June 11, 2007 Share Posted June 11, 2007 is there a goto/skip equilent for php like there is in c++ and vb. By goto i mean a line in the code not a redirect. Have had a look but cant find any good examples. Waz Quote Link to comment https://forums.phpfreaks.com/topic/55065-solved-goto/ Share on other sites More sharing options...
mjlogan Posted June 11, 2007 Share Posted June 11, 2007 are you looking for exit for? for breaking out of a for loop for example, but a GOTO maybe you need to rethink your logic?! Quote Link to comment https://forums.phpfreaks.com/topic/55065-solved-goto/#findComment-272212 Share on other sites More sharing options...
waz Posted June 11, 2007 Author Share Posted June 11, 2007 what my logic is simple i need to do a path check with a path variable which changes location every time its not found with a maxium of 3 paths now if i dont find it i need to skip some code under neath now i am aware people generally flame gotos and yes it is frowned upon however in some casses they are acceptable and i need to break out of loop and this is easiest way to write it. Quote Link to comment https://forums.phpfreaks.com/topic/55065-solved-goto/#findComment-272216 Share on other sites More sharing options...
kathas Posted June 11, 2007 Share Posted June 11, 2007 Firstly i suggest you use a bit of punctuation while you post, especially if you talk about logic which is hard to get... Now secondly there are many ways to implement any logic with php Using switch,if ... then ... else..., looping, functions . now if i have understood correctly from your post since you only want to check one variable i suggest you use the switch statement which faster than multiple if...then...else . Quote Link to comment https://forums.phpfreaks.com/topic/55065-solved-goto/#findComment-272221 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.