dagnasty Posted October 30, 2006 Share Posted October 30, 2006 What's the word to terminate a function? Google keeps turning up exit and die, but I just want to exit the function, not cancel script execution. Quote Link to comment Share on other sites More sharing options...
dagnasty Posted October 30, 2006 Author Share Posted October 30, 2006 Apparently I've been away from PHP for too long. The word I was looking for was return. I feel like an idiot. Quote Link to comment Share on other sites More sharing options...
Orio Posted October 30, 2006 Share Posted October 30, 2006 You can use "return". Example-[code]function my_func($var){echo "123";if($var>0) return;echo "456";}[/code]if var is a positive number the function will echo 123456. If it's not it will echo 123.Orio. Quote Link to comment 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.