What is the correct PHP function to use for redirecting to another page?

When you want to redirect a user to another page in PHP, you can use the header() function with the Location parameter set to the URL you want to redirect to. This function sends a raw HTTP header to the browser, which tells it to redirect to the specified page. Make sure to call the header() function before any output is sent to the browser, as headers must be sent before any content.

<?php
// Redirect to another page
header("Location: http://www.example.com");
exit();
?>