What potential issues can arise when using the header() function for redirection in PHP scripts?
Potential issues that can arise when using the header() function for redirection in PHP scripts include headers already being sent, leading to a "Cannot modify header information" error. To solve this issue, make sure that no output is sent to the browser before using the header() function for redirection.
<?php
ob_start(); // Start output buffering
// Your PHP code here
ob_end_clean(); // Clean the output buffer
header("Location: https://www.example.com");
exit;
?>