Are there alternative functions to header() that can redirect to the current file in PHP?

When redirecting to the current file in PHP, the header() function is commonly used. However, an alternative approach is to use the $_SERVER['PHP_SELF'] variable along with the header() function to achieve the same result. This method can be useful in cases where the header() function is not available or not preferred.

// Alternative method to redirect to the current file in PHP
$redirect_url = $_SERVER['PHP_SELF'];
header("Location: $redirect_url");
exit();