Hi,

I have a file foo.php that includes a file bar.php. foo.php includes the
values that bar.php modifies. If bar.php doesn't like the values foo.php
creates, it will exit(). Since I am looping though an array of values in
foo.php I don't want exit() to kill the loop, but instead I want it just to
kill any code in bar.php and let foo.php continue.

Anyone know a how I can do this? Do I need to use another function other
than exit()?

TIA

    ay 😃
    that's a very very bad coding style if you work that way. you'll never get happy with that.

    you NEVER should use exit() or die() in included files!
    rather make functions or objects inside your include files, which you call in the original file and return TRUE or FALSE or any other variables you want, and depending on that you decide in the original file if the script will die ...

    i don't think there will be a way of avoiding your problem with any other function.

      To follow on from axo, you can use return to leave a function without stopping the whole shabang.

      You could return TRUE for successful end, or an error string to help track down the problem.

      HTH,

      Mike

        Write a Reply...