How can the use of exit() function affect the flow of PHP script execution in the context of page redirection?

When the exit() function is called in PHP, it immediately terminates the script execution and sends a specified status code to the browser. This can affect the flow of the script, especially when used for page redirection, as any code after the exit() function will not be executed. To properly redirect to a new page without disrupting the script execution, it is recommended to use header() function for redirection instead of exit().

// Redirect to a new page without disrupting the script execution
header("Location: new_page.php");
exit();