moisesbr Posted August 15, 2013 Share Posted August 15, 2013 HI I have a code as below. But some times many "if"s can turn the program confuse, specialy if they are at the end of program.##################################If if today is sunday = "today is sunday if not suday show HTML code endif ############################## Is is possible to do as below to avoid endif at the end of very long program ? If if today is sunday= "today is sunday" Stop execution here. ## here I look for something as a return or cancel command used in other languagesendif show HTML code Quote Link to comment Share on other sites More sharing options...
Solution cyberRobot Posted August 15, 2013 Solution Share Posted August 15, 2013 Perhaps exit() is what you're looking for: http://php.net/manual/en/function.exit.php Quote Link to comment Share on other sites More sharing options...
clint Posted August 15, 2013 Share Posted August 15, 2013 (edited) You mean like: <?php if ($today =="Sunday") { echo 'today is sunday'; } ?> along those lines? Or as cyberRobot said ^^ Edited August 15, 2013 by clint Quote Link to comment Share on other sites More sharing options...
moisesbr Posted August 15, 2013 Author Share Posted August 15, 2013 Hi clint Maybe I will achive it by inserting exit () as below. Not sure... <?phpif ($today =="Sunday") {echo 'today is sunday'; ### exit () } ?> ## execute HTML code here if it's not sunday. Quote Link to comment Share on other sites More sharing options...
cyberRobot Posted August 15, 2013 Share Posted August 15, 2013 If all you want to do is display a message and prevent further code from being executed on Sundays, exit() is what you're looking for. If you're looking to accomplish something else, let us know. 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.