What are the potential consequences for SEO ranking when using header redirects in PHP?

When using header redirects in PHP for SEO purposes, it is important to be cautious as it can have potential consequences on SEO ranking. Search engines may not follow the redirect properly or may not pass on the link equity to the new URL, leading to a drop in rankings. To avoid this issue, it is recommended to use 301 redirects for permanent moves and ensure that the redirect is implemented correctly to maintain SEO value.

<?php
// Redirect to new URL with 301 status code
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/new-page");
exit();
?>