How to read FULL url?

Hi guys,

consider this:
http://test.com/?var=foo#test

How can i read the full url in PHP?
Tons of scripts and examples but the closest they get is
http://test.com/?var=foo

i need to read the entire thing including “#test

in javascript this is done with:
top.location.href

how is this done in PHP?

thx