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. Link to comment https://forums.phpfreaks.com/topic/25593-hey-guys-quick-easy-question/ 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. Link to comment https://forums.phpfreaks.com/topic/25593-hey-guys-quick-easy-question/#findComment-116806 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. Link to comment https://forums.phpfreaks.com/topic/25593-hey-guys-quick-easy-question/#findComment-116807 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.