I have a confusion in using PHP header location. which way is best practice...?
if(true){
header("location:somepage.php");
}
or
if(true){
header("location:somepage.php");
exit;
}
After sending the `Location:' header PHP will continue parsing, and all code below the header() call will still be executed. So instead use your second example:
if(true){
header("location:somepage.php");
exit;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With