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

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:

Archived

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

×
×
  • 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.