What is the purpose of using "exit" after a header redirect in PHP?
Using "exit" after a header redirect in PHP is important to ensure that the redirect happens immediately and no further code is executed. If "exit" is not used, the script will continue to execute after the header redirect, which may cause unexpected behavior or errors.
<?php
// Perform a header redirect
header("Location: new_page.php");
exit; // Ensure that no further code is executed
?>