What is the purpose of using the "header" function in PHP for redirection?
The "header" function in PHP is used for redirection, allowing you to send a raw HTTP header to the browser, which tells it to redirect to a different page. This is useful for scenarios where you want to redirect users to another page after they have completed an action or to handle errors by redirecting users to an error page.
<?php
// Redirect to a different page
header("Location: https://www.example.com/newpage.php");
exit();
?>