Jump to content

Recommended Posts

G'day Guys,

 

Here is a Query from a quer bloke:

(Visualising VB code structure in my head as I type this)

 

I want to create a code block, Sub, Function whatever you want to call it.

 

I want to exit that block but still permit the PHP script to run. (Example Ideal World: Use a whole bunch of Includes with the ability to use

exit();

without stopping the main script.)

 

I'm after either a push in the right direction or a recomendation on a way to do this.

 

At this stage all I can think of is to use

continue;

and place all my code in a loop which loops once.

 

If this post is a little too Dr. Seuss please let me know and I will try to reword it. Thanks - humpty

Link to comment
https://forums.phpfreaks.com/topic/67443-best-way-to-exit-code-blocks/
Share on other sites

... but if you just want to exit the funtion why not use return ?

 

That was exactly the point, I wasn't in a function to start with.  That does seem like the best way to go though. A function with no variables will just as well as a function with variables, and on the same side of the fence there is no need to return any values etc, just use return to exit that function.

 

That is what I was looking for, seems like it would be the best and closest thing to a sub.

 

Thanks dudes. (will leave topic unsolved for a bit in case someone comes up with somethign else)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.