What is the function to extract the referrer from an incoming request in PHP?

To extract the referrer from an incoming request in PHP, you can use the `$_SERVER['HTTP_REFERER']` superglobal variable. This variable contains the URL of the referring page, if any. You can use this information to track where the request is coming from or to redirect the user back to the referring page.

// Extract the referrer from an incoming request
$referrer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : 'No referrer';

echo $referrer;