pquery Posted June 18, 2008 Share Posted June 18, 2008 Quick Q, because maybe I'm having a little brain fart.... I'm building a function that's checking to see if a someone has a record on 20 different tables and will then calculate cumulative totals, but I want it to stop if it doesn't find a record on any of the tables as to save processes. would a break; statement work like used on a switch? ex: if($count1==1){ $total++; }else { break; } I know break can be used to break out of loops but will it break out of the function totally? I'm planning to just have this function included on a variety of different pages. thanks Link to comment https://forums.phpfreaks.com/topic/110734-solved-quick-question-about-breaking-out-of-a-function/ Share on other sites More sharing options...
kenrbnsn Posted June 18, 2008 Share Posted June 18, 2008 No. You need to use the "return" statement to exit a function. Ken Link to comment https://forums.phpfreaks.com/topic/110734-solved-quick-question-about-breaking-out-of-a-function/#findComment-568091 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.