jaymc Posted February 6, 2009 Share Posted February 6, 2009 How can i exit out of a function to stop any code thereafter from executing, but carry on exectution the rest of the script? function beans() { echo "statement1 - "; exit(); echo "statement2 - "; } beans(); echo "hello"; In that example I would like the output to be statement1 - hello at the moment it is statement1 - Quote Link to comment https://forums.phpfreaks.com/topic/144119-solved-exit-out-of-function/ Share on other sites More sharing options...
Maq Posted February 6, 2009 Share Posted February 6, 2009 use return; instead of exit(); EDIT: You're also in the wrong section... Quote Link to comment https://forums.phpfreaks.com/topic/144119-solved-exit-out-of-function/#findComment-756217 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.