How can PHP be used to automatically open a new page within the same website after a certain time delay?

To automatically open a new page within the same website after a certain time delay using PHP, you can use the header() function in combination with the sleep() function. First, set the delay time using sleep(), then use header() to redirect to the new page.

<?php
// Set the delay time in seconds
$delay = 5;

// Delay execution for specified time
sleep($delay);

// Redirect to the new page
header("Location: new_page.php");
exit;
?>