How can I get the fragment (value after hash '#') from a URL in php?
http://domain.com/site/gallery/1#photo45 I want
If you want to get the value after the hash mark or anchor as shown in a user's browser: This isn't possible with "standard" HTTP as this value is never sent to the server (hence it won't be available in
If it's only about parsing a known URL from whatever source, the answer by mck89 is perfectly fine though.
That part is called "fragment" and you can get it in this way:
$url=parse_url("http://domain.com/site/gallery/1#photo45 "); echo $url["fragment"]; //This variable contains the fragment