What are the potential pitfalls or drawbacks of using the header function in PHP for request forwarding?

One potential pitfall of using the header function in PHP for request forwarding is that it can cause headers to be sent prematurely, leading to errors or unexpected behavior. To solve this issue, it is recommended to use output buffering to ensure that headers are sent at the appropriate time.

ob_start();
header("Location: newpage.php");
ob_end_flush();
exit();