Why is it recommended to use exit(); after header('Location: login')?

When using header('Location: login') to redirect a user to another page, it is recommended to use exit(); immediately after to prevent any further code execution that may interfere with the redirection process. If the code continues to execute after the header function, it may cause unexpected behavior or errors.

header('Location: login');
exit();