Page 1 of 1

How to stop function code after header("location: $url")

Posted: Wed Jul 22, 2009 6:44 am
by lwc
The documentation for "header" says to use "exit" after "header".

Should I use "return" instead of "exit" when header("location: $url") is ran from inside a function? The documentation doesn't relate to such a scenario.

Thanks!

Re: How to stop function code after header("location: $url")

Posted: Wed Jul 22, 2009 7:14 am
by VladSun
Use exit().
A return() called in a function doesn't guarantee that the code execution will stop immediately after the function call.