That depends by what you mean "in a link"... HTML/Javascript is client-side code, and PHP is server-side code, so if you mean can you execute PHP code in an onClick handler, then no, that's not directly possible ('not directly' meaning without something like AJAX).
You can, however, link to a "logout.php" page which destroys the session data.