What are the differences between using $HTTP_REFERER and $_SERVER["HTTP_REFERER"] in PHP?

When accessing the referring URL in PHP, it is recommended to use $_SERVER["HTTP_REFERER"] instead of $HTTP_REFERER. This is because $HTTP_REFERER is not a predefined variable in PHP and may not always be available, leading to potential errors. $_SERVER["HTTP_REFERER"], on the other hand, is a server variable that contains the referring URL and is more reliable.

$referring_url = isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : '';
echo $referring_url;