ifif i understand your problem, you want to retrieve hash value from a url then use parse_url
with PHP_URL_FRAGMENT argument
$url = 'http://username:password@hostname/path?arg=value#anchor';
print_r(parse_url($url));
echo parse_url($url, PHP_URL_FRAGMENT);
will return
[fragment] => anchor
Reference