Jump to content


Photo

Question about exit() function


  • Please log in to reply
2 replies to this topic

#1 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 04 March 2006 - 12:28 AM

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:
require 'Script2.php';
blahblahblah();
echo 'junk';


And Script2.php:
function blahblahblah()
{
       exit;
}


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!


#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 04 March 2006 - 02:23 AM

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

#3 hadoob024

hadoob024
  • Members
  • PipPipPip
  • Advanced Member
  • 192 posts

Posted 04 March 2006 - 05:51 AM

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 :)





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users