I have looked at a few topics (here & google) regarding detecting browser exit in php and im not really any clearer on how to do so.
I tried the register_s
One solution that is at least fool resistant is to send a heartbeat to the server using Javascript and Ajax, then assuming that the browser window has been closed when the signal stops pulsing.
Another would be to use web sockets to maintain a constant connection until the browser window closes.
In any case it would take quite a bit of work from your part to set it up