Read #hash from URL with jQuery

You can use the location.hash property to grab the hash of the current page:

var hash = window.location.hash;

window.location.hash its that simple.

donot use all those methods which consume CPU and effects performance.

If DOM provides something predefined use it first.

To pass value to PHP please do and ajax call to php.

var hash = window.location.hash;

$.ajax({
    url: 'someurl.php',
    data: {hash: hash},
    success: function(){}
})