Jump to content

Archived

This topic is now archived and is closed to further replies.

hadoob024

Question about exit() function

Recommended Posts

I have a question regarding the exit() function. I read the manual on this, but it didn't really answer my question. Suppose I have the following:

Script1.php:
[code]
require 'Script2.php';
blahblahblah();
echo 'junk';
[/code]


And Script2.php:
[code]
function blahblahblah()
{
       exit;
}
[/code]


So basically my question is, when exit() gets called from within Script2.php, does it just stop the execution of Script2.php? Or does it also stop the execution of Script1.php? Thanks!

Share this post


Link to post
Share on other sites
The easiest wayt to find out is to try it.

Using the exit() function will stop the script from running nomatter where it is used.

Ken

Share this post


Link to post
Share on other sites
cool. thanks. yeah, i should've just followed my own example. in my real script, the main script exits anyway, so i couldn't tell what was causing the script to end, just it running to completion, or the exit() being called in the included script.

the closer i'm getting to this thing being done, the more re-assurance i need that something is correct. it's like i'm a 5 year old or something :)

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.