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 - 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... 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
Archived
This topic is now archived and is closed to further replies.