In PHP, if you want to find the sesskey of the user (which is _not_ the session of the current user, but, instead, a CSRF protection mechanism), then call the function:
sesskey();
If you need that in some javascript, then you'll need to pass it to your javascript when you initialise it from your PHP code.
sesskey();
If you need that in some javascript, then you'll need to pass it to your javascript when you initialise it from your PHP code.