When including a file in another, I want to end the parsing after a certain if statement. Is it ill advised to use this method for terminating a parsing of a script, and does exit; terminate parsing at all, or just the rest of the current php file?
+5
A:
exit stops the whole script. In included files you can use return to exit from the current file without stopping the whole script.
MitMaro
2010-01-03 19:43:49
And return; would still work even if it's not included inside a function?
sombe
2010-01-03 19:46:04
+1! @Gal From the docs `return() will also end the execution of an eval() statement or script file`
Doug Neiner
2010-01-03 19:47:04