What is the importance of using header() function in PHP for redirection?
The header() function in PHP is important for redirection because it allows us to send HTTP headers to the browser, which can be used to redirect the user to a different page. This is useful for scenarios such as after form submissions, login/logout actions, or when a user needs to be redirected to a different page based on certain conditions.
<?php
// Redirect to a different page
header("Location: https://www.example.com");
exit();
?>