Are there alternative methods or functions in PHP that can be used instead of header(location: $url) to redirect users to a different URL?

When redirecting users to a different URL in PHP, the header() function with the location parameter is commonly used. However, an alternative method to achieve the same result is by using the PHP function header("Location: $url") along with the exit() function to stop further script execution.

<?php
$url = "https://www.example.com";
header("Location: $url");
exit();
?>