What is the best way to implement automatic redirection in PHP?

To implement automatic redirection in PHP, you can use the header() function to send a raw HTTP header to the browser, instructing it to redirect to a new page. This is commonly used after processing a form submission or when a user needs to be redirected to a different page based on certain conditions.

<?php
// Redirect to a new page
header("Location: https://www.example.com/newpage.php");
exit();
?>