How can the meta refresh function be effectively used for automatic redirection in PHP?

The meta refresh function can be effectively used for automatic redirection in PHP by including a meta tag in the HTML output that specifies the time delay and the target URL for redirection. This can be useful for scenarios where a user needs to be redirected to a different page after a certain period of time.

<?php
// PHP code to generate HTML output with meta refresh for automatic redirection
echo '<html>';
echo '<head>';
echo '<meta http-equiv="refresh" content="5;url=redirected_page.php">';
echo '</head>';
echo '<body>';
echo 'You will be redirected to another page in 5 seconds.';
echo '</body>';
echo '</html>';
?>