What is the purpose of using exit; after header(); in PHP?
Using exit; after header(); in PHP is used to prevent any further code execution after the header() function has been called. This is important because header() is used to send HTTP headers to the client, and any output generated before the headers are sent can cause errors. By using exit; after header();, you ensure that no additional content is sent to the client before the headers, preventing any potential issues.
header("Location: https://www.example.com");
exit;