Im not sure,, but i suppose u could do it through javascript. on_close() or whatever the stamement is, do something
im not sure how u could implement it, but i do know that there are functions availble for dealing with browser when the user close the browser.. just take pop-ups!! a lot of the stupid sites throw a pop-up at u when u close the browser.
U do say "in php" sorry have no idea...