Jump to content

[SOLVED] How to escape/ kill/ abort from within a function?


physaux

Recommended Posts

I have a function,

<?php
function myfunction($var1){
if($var1=="none"){
kill;
}
...
}
?>

 

How can I abort the function, at the point of "kill"

-I know I could just wrap the rest of the function in a opposite if statement, but I specifically want to just have an escape function, as my "escape point" might be deep in brackets next time, bla bla

 

I know you can escape out of loops(don't remember the exact way but idc), so I am wondering if you can from functions?

 

*the function does not return any value

Link to comment
Share on other sites

this will just "skip" to the end of the function? Or will it stop my overall script? They are not very clear with it. I just want this as a "trigger" inside of a function, so that when it is called and the value is a unwanted one, it finishes.

 

will this do the trick? It's confusing they say it terminates the php script. :confused:

Link to comment
Share on other sites

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.