Are there alternative methods to achieve the same result as using the header() function for redirection in PHP?

When using the header() function for redirection in PHP, an alternative method is to use the meta refresh tag in HTML. This method involves outputting HTML code to the browser to redirect to a different URL after a specified time interval. This can be useful in cases where the header() function cannot be used, such as when headers have already been sent.

<?php
echo '<meta http-equiv="refresh" content="0;url=http://www.example.com">';
exit;
?>