What is the function of the header() function in PHP?
The header() function in PHP is used to send raw HTTP headers to the client. This function is commonly used to send a new HTTP header, such as a redirect, content type, or caching directives, before any actual output is sent to the browser. It is important to note that the header() function must be called before any actual output is sent to the browser, including whitespace.
<?php
// Redirect to a new page after 5 seconds
header("refresh:5;url=redirect_page.php");
?>