$link = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."#ancoraggio";

echo "<a href ='$link'>$link</a>";