How to "break" inside an if/else statement?

I have a string from if/else statement and i would like to have a function which is stopping the script from further reading.

Could you show an example of what you have?

To completely stop the rest of the script from running you can just do


exit;

If you just want to ext out of the if/else statement do a


return;

If you get a chance post some of the code to help clarify your question. Here’s a guess at what might work:

// some php code ...
// ...
// ...

$flag = getFlagFunction();
if($flag) {exit;}

// other php code if condition is not true.
// ...
// ...

No, that will stop the script execution as well. However if it is an include, it will continue the “parent” script.

Thanx ,
return is working ,
exit() also ,
appreciate your help.

Now that’s interesting. I don’t think I ever knew that. Is there anyway to exit() the script from an included file?

call exit();

yep, I was talking about the return only.

Not sure what I was reading then… :injured: