View Full Version : Exit () vs Die()

06-18-2006, 03:09 AM
I know that it stops the script dead, but how would I make it just stop the current script. Lets say I am making a script that lets a user enter info, but if the info he provided doesn't meet my character requirements so I use the exit; or die; & show the form again.

I would like to for the rest of my site to finish loading, but for the processing script for the info to stop only. Like for my footer of my page I have it in a footer.php & include it at the bottom of each page. When I use the exit function the footer wont load since the page has been stopped dead.

If I haven't explained clearly I can explain more....


06-18-2006, 03:29 AM
According to the manual, exit (http://www.php.net/exit) and die (http://www.php.net/die) do the same thing - output a message and terminate the current script. Just wrap your script in a gigantic "if" condition. Process the script if the condition is met. Don't process the script if it isn't.

06-18-2006, 10:36 AM
to exit processing of an include'd script, you can use 'return false'. The page that included it will carry on.