Since you are modifying this code. Could you somehow to optimize this code so that developers do not need to copy paste unset($_SESSION['var_name']); all the time? Maybe create a generic function for the project and place it in a right spot. Function which will take an array of session variable names and then unsets them in a loop.