I'm including file inner.php in outer.php, I have a condition in inner.php on which I want to stop executing inner.php but NOT the whole script, i.e. I want to jump to the first line in outer.php after the inclusion of inner.php, and I don't want to wrap all of the code in inner.php in an if statement.
Is there a way to do this otherwise?
Just do return; or return($value); on top level of the inner.php file.
If called from the global scope, then execution of the current script file is ended. If the current script file was
include()edorrequire()ed, then control is passed back to the calling file. Furthermore, if the current script file wasinclude()ed, then the value given toreturn()will be returned as the value of theinclude()call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With