I would like to create a forward-function that terminates the caller-function.
Currently I’m using “exit” in the callee-function to achieve this.
function caller (){
if($condition){
forward();
}
//code that is not executet if $condition is true
}
//current solution
function forward(){
//do something
exit;
}
I would like to omit the return-statement after calling the forward-function.
I guess there is no other way except throwing an exception?
Thanks for your help.
There are several ways:
1) Enclosing the code after
ifinfoelsebranch2) As you mentioned, throwing an exception
3) or plainly doing: