What is the best practice for implementing a URL redirection using PHP?

When implementing URL redirection using PHP, it is best practice to use the header() function to send a raw HTTP header to perform the redirection. This method is efficient and ensures that the redirection happens before any content is sent to the browser.

<?php
// Redirect to a new URL
$new_url = 'https://www.example.com/new-page';
header('Location: ' . $new_url);
exit();
?>