What is the recommended method for user redirection in PHP after registration?

After a user successfully registers on a website, it is common practice to redirect them to a specific page such as a dashboard or a welcome page. This can be achieved by using the header() function in PHP to send a raw HTTP header to the browser, specifying the location to redirect to.

// After successful registration
header("Location: dashboard.php");
exit();