Its depend upon the condition which is that how you are going to keeping the session? either you are using PHP's built in session management or a custom session management.
Have a look
there[
^] for nice solution which gives you idea how to clear based on condition.