header("Location: https://example.com/newpage.php"); exit;
header("Refresh: 5; url=https://example.com/newpage.php"); echo "You will be redirected in 5 seconds...";
header("Location: https://example.com/error.php", true, 404); exit;This code redirects the user to `https://example.com/error.php` with a status code of 404 (not found). These examples use the `header` function, which is part of the PHP core library. No external package or library is required to use this functionality.