Stooney Posted September 17, 2008 Share Posted September 17, 2008 Is it possible to stop execution of an included script without stopping execution of everything else? In this example, the exit() in file1.php would stop everything and stuff2() won't happen. Is there a way to just stop file1.php and continue what was going on outside of the include? <?php stuff(); include('file1.php'); stuff2(); ?> file1.php <?php exit(); dont_do_this(); ?> Link to comment https://forums.phpfreaks.com/topic/124716-solved-stop-included-script/ Share on other sites More sharing options...
DarkWater Posted September 17, 2008 Share Posted September 17, 2008 I'm pretty sure that you can't. Why would you want to? Give us a real situation. Link to comment https://forums.phpfreaks.com/topic/124716-solved-stop-included-script/#findComment-644206 Share on other sites More sharing options...
thesaleboat Posted September 17, 2008 Share Posted September 17, 2008 take off the exit in the file1.php or have an if statement determine if it should actually exit or not. also put stuff2() prior to the include Link to comment https://forums.phpfreaks.com/topic/124716-solved-stop-included-script/#findComment-644212 Share on other sites More sharing options...
Stooney Posted September 17, 2008 Author Share Posted September 17, 2008 I will just go with an if/else, I was hoping there was a cleaner/less ugly way of doing it but I guess not. Link to comment https://forums.phpfreaks.com/topic/124716-solved-stop-included-script/#findComment-644221 Share on other sites More sharing options...
PFMaBiSmAd Posted September 17, 2008 Share Posted September 17, 2008 Untested, but should work -> http://php.net/return Link to comment https://forums.phpfreaks.com/topic/124716-solved-stop-included-script/#findComment-644226 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.