In what scenarios is it recommended to use header() over meta refresh for automatic redirection in PHP?

It is recommended to use header() over meta refresh for automatic redirection in PHP when you need to perform a server-side redirection that is faster, more reliable, and SEO-friendly. Header() function sends an HTTP header to the browser, instructing it to redirect to a different URL, while meta refresh relies on HTML meta tags and can be slower and less reliable.

<?php
// Redirect to a different page using header() function
header("Location: https://www.example.com/new_page.php");
exit();
?>